Update backupapp.py
Browse files- backupapp.py +135 -38
backupapp.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,58 @@ def generate_speech_textarea(text_to_speak):
|
|
33 |
'''
|
34 |
components.html(documentHTML5, width=1280, height=500)
|
35 |
|
36 |
-
|
37 |
-
import matplotlib.pyplot as plt
|
38 |
import streamlit as st
|
39 |
-
import json
|
40 |
-
import plotly.express as px
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
def plot_state_outline(state_code, us_states_geojson, state_names):
|
43 |
state_name = state_names.get(state_code, 'Unknown')
|
44 |
fig = px.choropleth(locations=[state_name], geojson=us_states_geojson,
|
@@ -48,29 +100,18 @@ def plot_state_outline(state_code, us_states_geojson, state_names):
|
|
48 |
fig.update_layout(title=f"{state_name} State Outline")
|
49 |
st.plotly_chart(fig)
|
50 |
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
}
|
59 |
-
|
60 |
-
|
61 |
-
icons = ['π¦', 'π΄', 'π', 'π', 'π€ ', 'π½', 'π°']
|
62 |
-
|
63 |
-
for state, icon in zip(states, icons):
|
64 |
-
st.write(f"{icon} {state}")
|
65 |
-
plot_state_outline(state, us_states_geojson, state_names)
|
66 |
|
67 |
-
|
68 |
-
# Display maps for each state
|
69 |
-
for state, icon in zip(states, icons):
|
70 |
-
st.write(f"{icon} {state}")
|
71 |
-
plot_state_outline(state, us_states_geojson, state_names)
|
72 |
-
|
73 |
-
# Main code
|
74 |
st.title('U.S. States Trivia πΊοΈ')
|
75 |
|
76 |
for i, (state, icon) in enumerate(zip(states, icons)):
|
@@ -79,25 +120,81 @@ for i, (state, icon) in enumerate(zip(states, icons)):
|
|
79 |
# Expanders for each state to outline fascinating facts
|
80 |
with st.expander(f"See Fascinating Facts about {state}"):
|
81 |
text_to_speak = ""
|
82 |
-
|
83 |
if state == 'MN':
|
84 |
-
text_to_speak = "π¦ **Minnesota**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
elif state == 'CA':
|
86 |
-
text_to_speak = "π΄ **California**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
elif state == 'WA':
|
88 |
-
text_to_speak = "π **Washington**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
elif state == 'FL':
|
90 |
-
text_to_speak = "π **Florida**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
elif state == 'TX':
|
92 |
-
text_to_speak = "π€ **Texas**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
elif state == 'NY':
|
94 |
-
text_to_speak = "π½ **New York**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
elif state == 'NV':
|
96 |
-
text_to_speak = "π° **Nevada**
|
97 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
st.markdown(text_to_speak)
|
99 |
-
|
100 |
-
plot_state_outline(state, us_states_geojson, state_names)
|
101 |
|
102 |
if st.button(f"π Read {state}'s Facts Aloud"):
|
103 |
-
generate_speech_textarea(text_to_speak)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
import streamlit as st
|
|
|
|
|
44 |
|
45 |
+
def ListMaps():
|
46 |
+
MapInfo = """
|
47 |
+
## π Map Techniques to Understand Various Aspects
|
48 |
+
- **General Mapping Techniques**
|
49 |
+
- πΊοΈ [US States](https://huggingface.co/spaces/awacke1/USStates)
|
50 |
+
- π [World Area PyDeck](https://huggingface.co/spaces/awacke1/StreamlitPydeckMapVisualViewStateForLatitudeLongitude)
|
51 |
+
- π [US Corporation Map and CSV Location Data Loader](https://huggingface.co/spaces/awacke1/UnitedStatesMapAIandNLP)
|
52 |
+
- π [US Taxonomy Datasets](https://huggingface.co/spaces/awacke1/NPI-Provider-Map-By-Taxonomy-Search)
|
53 |
+
- π [City, State - Latitude and Longitude Search](https://huggingface.co/spaces/awacke1/Google-Maps-Web-Service-Py) (try Mound, MN)
|
54 |
+
## π₯ Medical Centers and Hospitals in US States
|
55 |
+
- **Minnesota**
|
56 |
+
- π₯ [State of MN Med Centers](https://huggingface.co/spaces/awacke1/Minnesota-Medical-Centers-Streamlit)
|
57 |
+
- π¨ [State of MN: Hospital Details](https://huggingface.co/spaces/awacke1/MN.Map.Hospitals.Top.Five)
|
58 |
+
- **Massachusetts**
|
59 |
+
- π₯ [State of MA Medical Centers](https://huggingface.co/spaces/awacke1/Streamlit-Google-Maps-Massachusetts)
|
60 |
+
- π [State of MA Reliant](https://huggingface.co/spaces/awacke1/Streamlit-Google-Maps-Reliant)
|
61 |
+
- **California**
|
62 |
+
- π₯ [State of CA Medical Centers](https://huggingface.co/spaces/awacke1/Streamlit-Google-Maps-California)
|
63 |
+
- π¨ [State of CA Hospital Details](https://huggingface.co/spaces/awacke1/California-Medical-Centers-Streamlit)
|
64 |
+
- ποΈ [State of CA Attractions](https://huggingface.co/spaces/awacke1/Map-California-AI)
|
65 |
+
- **Texas**
|
66 |
+
- π₯ [State of TX Medical Centers](https://huggingface.co/spaces/awacke1/Streamlit-Google-Maps-Texas)
|
67 |
+
- **New Jersey**
|
68 |
+
- π₯ [State of NJ Hospitals](https://huggingface.co/spaces/awacke1/VizLib-TopLargeHospitalsNewJersey)
|
69 |
+
## π Mythical and Historical Locations
|
70 |
+
- **Iceland**
|
71 |
+
- π° [Iceland Myth Places and Routes](https://huggingface.co/spaces/awacke1/Maps.Markers.Honor.Iceland)
|
72 |
+
## πΊπΈ Specific US Data Searches
|
73 |
+
- **NPI Registry Mental Health Provider Search**
|
74 |
+
- π§ [NPI Registry Mental Health Provider Search and Cluster Map](https://huggingface.co/spaces/awacke1/Gradio-Maps-Latitude-Longitude)
|
75 |
+
- **US City Specific Information**
|
76 |
+
- π [US City FIPS code, Location, Population](https://huggingface.co/spaces/awacke1/CityFipsLocationandPopulation)
|
77 |
+
"""
|
78 |
+
st.markdown(MapInfo)
|
79 |
+
return MapInfo
|
80 |
+
|
81 |
+
# Call the function to display the maps
|
82 |
+
ListMaps()
|
83 |
+
|
84 |
+
|
85 |
+
# States and Icons
|
86 |
+
states = ['MN', 'CA', 'WA', 'FL', 'TX', 'NY', 'NV']
|
87 |
+
icons = ['π¦', 'π΄', 'π', 'π', 'π€ ', 'π½', 'π°']
|
88 |
+
state_names = {
|
89 |
+
'MN': 'Minnesota', 'CA': 'California', 'WA': 'Washington',
|
90 |
+
'FL': 'Florida', 'TX': 'Texas', 'NY': 'New York', 'NV': 'Nevada'
|
91 |
+
}
|
92 |
+
|
93 |
+
# Plot a State
|
94 |
def plot_state_outline(state_code, us_states_geojson, state_names):
|
95 |
state_name = state_names.get(state_code, 'Unknown')
|
96 |
fig = px.choropleth(locations=[state_name], geojson=us_states_geojson,
|
|
|
100 |
fig.update_layout(title=f"{state_name} State Outline")
|
101 |
st.plotly_chart(fig)
|
102 |
|
103 |
+
# Plot a List of States
|
104 |
+
us_states_geojson = "" # Reuse as Property
|
105 |
+
def PlotOutlines():
|
106 |
+
geojson_path = 'gz_2010_us_040_00_500k.json'
|
107 |
+
with open(geojson_path, 'r') as file:
|
108 |
+
us_states_geojson = json.load(file)
|
109 |
+
for state, icon in zip(states, icons):
|
110 |
+
st.write(f"{icon} {state}")
|
111 |
+
plot_state_outline(state, us_states_geojson, state_names)
|
112 |
+
return us_states_geojson
|
|
|
|
|
|
|
|
|
|
|
113 |
|
114 |
+
# Main
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
st.title('U.S. States Trivia πΊοΈ')
|
116 |
|
117 |
for i, (state, icon) in enumerate(zip(states, icons)):
|
|
|
120 |
# Expanders for each state to outline fascinating facts
|
121 |
with st.expander(f"See Fascinating Facts about {state}"):
|
122 |
text_to_speak = ""
|
123 |
+
|
124 |
if state == 'MN':
|
125 |
+
text_to_speak = """π¦ **Minnesota**
|
126 |
+
ποΈ Known as the 'Land of 10,000 Lakes'
|
127 |
+
π£ Famous for its fishing
|
128 |
+
πΆ Boundary Waters offers incredible canoeing
|
129 |
+
π Home to prestigious colleges
|
130 |
+
βοΈ Cold winters but lovely summers
|
131 |
+
π Largest city: Minneapolis
|
132 |
+
π Walleye: The state fish
|
133 |
+
π Home to the Minnesota Vikings."""
|
134 |
elif state == 'CA':
|
135 |
+
text_to_speak = """π΄ **California**
|
136 |
+
π Home to the Golden Gate Bridge
|
137 |
+
π¬ Center of the American entertainment industry
|
138 |
+
π Famous for Napa Valley's wine
|
139 |
+
π² Home to Redwood National Park
|
140 |
+
πββοΈ Excellent beaches and surf spots
|
141 |
+
ποΈ Yosemite National Park: A natural wonder
|
142 |
+
π΅ Death Valley: The hottest and driest area."""
|
143 |
elif state == 'WA':
|
144 |
+
text_to_speak = """π **Washington**
|
145 |
+
β Known for its coffee culture
|
146 |
+
π» Home to Mount Rainier
|
147 |
+
π Leading apple-producing state
|
148 |
+
π Rich in seafood, especially salmon
|
149 |
+
π§οΈ Known for its rainy weather
|
150 |
+
π² Olympic National Park: Diverse ecosystems
|
151 |
+
π Seattle: A tech hub and major city."""
|
152 |
elif state == 'FL':
|
153 |
+
text_to_speak = """π **Florida**
|
154 |
+
ποΈ Famous for its beaches
|
155 |
+
π’ Home to various amusement parks like Disney World
|
156 |
+
π Space launches from Cape Canaveral
|
157 |
+
π Known for the Everglades and alligators
|
158 |
+
π Major orange producer
|
159 |
+
π The Keys: A series of tropical islands
|
160 |
+
π° Miami: Known for its vibrant culture and nightlife."""
|
161 |
elif state == 'TX':
|
162 |
+
text_to_speak = """π€ **Texas**
|
163 |
+
π’οΈ Known for its oil and gas industry
|
164 |
+
π Famous for its barbecue
|
165 |
+
πΈ Rich musical heritage
|
166 |
+
π Home to many cattle ranches
|
167 |
+
π΅ Includes part of the Chihuahuan Desert
|
168 |
+
π Big Bend National Park: Stunning night skies
|
169 |
+
π Houston: Home to NASA's Johnson Space Center."""
|
170 |
elif state == 'NY':
|
171 |
+
text_to_speak = """π½ **New York**
|
172 |
+
ποΈ Home to New York City, the largest city in the U.S.
|
173 |
+
π Known as the Big Apple
|
174 |
+
π Major hub for arts and culture
|
175 |
+
ποΈ Adirondack Mountains offer outdoor adventures
|
176 |
+
π Famous for its style of pizza
|
177 |
+
π Niagara Falls: A natural wonder
|
178 |
+
ποΈ Finger Lakes: Known for wineries and beautiful scenery."""
|
179 |
elif state == 'NV':
|
180 |
+
text_to_speak = """π° **Nevada**
|
181 |
+
π Known for Las Vegas and its casinos
|
182 |
+
ποΈ Includes part of the Mojave Desert
|
183 |
+
πͺ Entertainment is a major industry
|
184 |
+
π Known for the Hoover Dam
|
185 |
+
π½ Area 51 is located here
|
186 |
+
ποΈ Lake Tahoe: A stunning freshwater lake
|
187 |
+
π Great Basin National Park: Known for its ancient bristlecone pines."""
|
188 |
+
|
189 |
st.markdown(text_to_speak)
|
190 |
+
|
191 |
+
# plot_state_outline(state, us_states_geojson, state_names)
|
192 |
|
193 |
if st.button(f"π Read {state}'s Facts Aloud"):
|
194 |
+
generate_speech_textarea(text_to_speak)
|
195 |
+
|
196 |
+
# Display maps
|
197 |
+
MapInfo = ListMaps()
|
198 |
+
|
199 |
+
us_states_geojson = PlotOutlines()
|
200 |
+
|