Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,12 @@ import geopandas as gpd
|
|
4 |
import matplotlib.pyplot as plt
|
5 |
import plotly.express as px
|
6 |
import json
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
# Function to generate HTML with textarea for speech synthesis
|
9 |
def generate_speech_textarea(text_to_speak):
|
@@ -33,12 +39,6 @@ def generate_speech_textarea(text_to_speak):
|
|
33 |
'''
|
34 |
components.html(documentHTML5, width=1280, height=500)
|
35 |
|
36 |
-
import geopandas as gpd
|
37 |
-
import matplotlib.pyplot as plt
|
38 |
-
import streamlit as st
|
39 |
-
import json
|
40 |
-
import plotly.express as px
|
41 |
-
|
42 |
|
43 |
def ListMaps():
|
44 |
MapInfo = """
|
@@ -84,6 +84,7 @@ def plot_state_outline(state_code, us_states_geojson, state_names):
|
|
84 |
st.plotly_chart(fig)
|
85 |
|
86 |
# Plot a List of States
|
|
|
87 |
def PlotOutlines():
|
88 |
geojson_path = 'gz_2010_us_040_00_500k.json'
|
89 |
with open(geojson_path, 'r') as file:
|
@@ -120,7 +121,7 @@ for i, (state, icon) in enumerate(zip(states, icons)):
|
|
120 |
|
121 |
st.markdown(text_to_speak)
|
122 |
|
123 |
-
plot_state_outline(state, us_states_geojson, state_names)
|
124 |
|
125 |
if st.button(f"🔊 Read {state}'s Facts Aloud"):
|
126 |
generate_speech_textarea(text_to_speak)
|
@@ -128,5 +129,5 @@ for i, (state, icon) in enumerate(zip(states, icons)):
|
|
128 |
# Display maps
|
129 |
MapInfo = ListMaps()
|
130 |
|
131 |
-
|
132 |
|
|
|
4 |
import matplotlib.pyplot as plt
|
5 |
import plotly.express as px
|
6 |
import json
|
7 |
+
import geopandas as gpd
|
8 |
+
import matplotlib.pyplot as plt
|
9 |
+
import streamlit as st
|
10 |
+
import json
|
11 |
+
import plotly.express as px
|
12 |
+
|
13 |
|
14 |
# Function to generate HTML with textarea for speech synthesis
|
15 |
def generate_speech_textarea(text_to_speak):
|
|
|
39 |
'''
|
40 |
components.html(documentHTML5, width=1280, height=500)
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
def ListMaps():
|
44 |
MapInfo = """
|
|
|
84 |
st.plotly_chart(fig)
|
85 |
|
86 |
# Plot a List of States
|
87 |
+
us_states_geojson = "" # Reuse as Property
|
88 |
def PlotOutlines():
|
89 |
geojson_path = 'gz_2010_us_040_00_500k.json'
|
90 |
with open(geojson_path, 'r') as file:
|
|
|
121 |
|
122 |
st.markdown(text_to_speak)
|
123 |
|
124 |
+
# plot_state_outline(state, us_states_geojson, state_names)
|
125 |
|
126 |
if st.button(f"🔊 Read {state}'s Facts Aloud"):
|
127 |
generate_speech_textarea(text_to_speak)
|
|
|
129 |
# Display maps
|
130 |
MapInfo = ListMaps()
|
131 |
|
132 |
+
us_states_geojson = PlotOutlines()
|
133 |
|