awacke1 commited on
Commit
f6897d9
β€’
1 Parent(s): aebb899

Update backupapp.py

Browse files
Files changed (1) hide show
  1. 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
- 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
  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
- geojson_path = 'gz_2010_us_040_00_500k.json'
52
- with open(geojson_path, 'r') as file:
53
- us_states_geojson = json.load(file)
54
-
55
- state_names = {
56
- 'MN': 'Minnesota', 'CA': 'California', 'WA': 'Washington',
57
- 'FL': 'Florida', 'TX': 'Texas', 'NY': 'New York', 'NV': 'Nevada'
58
- }
59
-
60
- states = ['MN', 'CA', 'WA', 'FL', 'TX', 'NY', 'NV']
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** \n🏞️ Known as the 'Land of 10,000 Lakes' \n🎣 Famous for its fishing \nπŸ›Ά Boundary Waters offers incredible canoeing \nπŸŽ“ Home to prestigious colleges \n❄️ Cold winters but lovely summers."
 
 
 
 
 
 
 
 
85
  elif state == 'CA':
86
- text_to_speak = "🌴 **California** \nπŸŒ‰ Home to the Golden Gate Bridge \n🎬 Center of the American entertainment industry \nπŸ‡ Famous for Napa Valley's wine \n🌲 Home to Redwood National Park \nπŸ„β€β™€οΈ Excellent beaches and surf spots."
 
 
 
 
 
 
 
87
  elif state == 'WA':
88
- text_to_speak = "🍎 **Washington** \nβ˜• Known for its coffee culture \nπŸ—» Home to Mount Rainier \n🍏 Leading apple-producing state \n🐟 Rich in seafood, especially salmon \n🌧️ Known for its rainy weather."
 
 
 
 
 
 
 
89
  elif state == 'FL':
90
- text_to_speak = "🌞 **Florida** \n🏝️ Famous for its beaches \n🎒 Home to various amusement parks like Disney World \nπŸš€ Space launches from Cape Canaveral \n🐊 Known for the Everglades and alligators \n🍊 Major orange producer."
 
 
 
 
 
 
 
91
  elif state == 'TX':
92
- text_to_speak = "🀠 **Texas** \nπŸ›’οΈ Known for its oil and gas industry \nπŸ– Famous for its barbecue \n🎸 Rich musical heritage \nπŸ„ Home to many cattle ranches \n🌡 Includes part of the Chihuahuan Desert."
 
 
 
 
 
 
 
93
  elif state == 'NY':
94
- text_to_speak = "πŸ—½ **New York** \nπŸ™οΈ Home to New York City, the largest city in the U.S. \n🍎 Known as the Big Apple \n🎭 Major hub for arts and culture \n🏞️ Adirondack Mountains offer outdoor adventures \nπŸ• Famous for its style of pizza."
 
 
 
 
 
 
 
95
  elif state == 'NV':
96
- text_to_speak = "🎰 **Nevada** \nπŸŒ† Known for Las Vegas and its casinos \n🏜️ Includes part of the Mojave Desert \nπŸŽͺ Entertainment is a major industry \nπŸ’Ž Known for the Hoover Dam \nπŸ‘½ Area 51 is located here."
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
+