|
import streamlit as st |
|
import streamlit.components.v1 as components |
|
import geopandas as gpd |
|
import matplotlib.pyplot as plt |
|
import plotly.express as px |
|
import json |
|
import geopandas as gpd |
|
import matplotlib.pyplot as plt |
|
import streamlit as st |
|
import json |
|
import plotly.express as px |
|
|
|
|
|
|
|
def generate_speech_textarea(text_to_speak): |
|
documentHTML5 = ''' |
|
<!DOCTYPE html> |
|
<html> |
|
<head> |
|
<title>Read It Aloud</title> |
|
<script type="text/javascript"> |
|
function readAloud() {{ |
|
const text = document.getElementById("textArea").value; |
|
const speech = new SpeechSynthesisUtterance(text); |
|
window.speechSynthesis.speak(speech); |
|
}} |
|
</script> |
|
</head> |
|
<body> |
|
<h1>π Read It Aloud</h1> |
|
<textarea id="textArea" rows="10" cols="80" readonly>''' |
|
documentHTML5 = documentHTML5 + text_to_speak |
|
documentHTML5 = documentHTML5 + ''' |
|
</textarea> |
|
<br> |
|
<button onclick="readAloud()">π Read Aloud</button> |
|
</body> |
|
</html> |
|
''' |
|
components.html(documentHTML5, width=1280, height=500) |
|
|
|
|
|
import streamlit as st |
|
|
|
def ListMaps(): |
|
MapInfo = """ |
|
## π Map Techniques to Understand Various Aspects |
|
- **General Mapping Techniques** |
|
- πΊοΈ [US States](https://huggingface.co/spaces/awacke1/USStates) |
|
- π [World Area PyDeck](https://huggingface.co/spaces/awacke1/StreamlitPydeckMapVisualViewStateForLatitudeLongitude) |
|
- π [US Corporation Map and CSV Location Data Loader](https://huggingface.co/spaces/awacke1/UnitedStatesMapAIandNLP) |
|
- π [US Taxonomy Datasets](https://huggingface.co/spaces/awacke1/NPI-Provider-Map-By-Taxonomy-Search) |
|
- π [City, State - Latitude and Longitude Search](https://huggingface.co/spaces/awacke1/Google-Maps-Web-Service-Py) (try Mound, MN) |
|
## π₯ Medical Centers and Hospitals in US States |
|
- **Minnesota** |
|
- π₯ [State of MN Med Centers](https://huggingface.co/spaces/awacke1/Minnesota-Medical-Centers-Streamlit) |
|
- π¨ [State of MN: Hospital Details](https://huggingface.co/spaces/awacke1/MN.Map.Hospitals.Top.Five) |
|
- **Massachusetts** |
|
- π₯ [State of MA Medical Centers](https://huggingface.co/spaces/awacke1/Streamlit-Google-Maps-Massachusetts) |
|
- π [State of MA Reliant](https://huggingface.co/spaces/awacke1/Streamlit-Google-Maps-Reliant) |
|
- **California** |
|
- π₯ [State of CA Medical Centers](https://huggingface.co/spaces/awacke1/Streamlit-Google-Maps-California) |
|
- π¨ [State of CA Hospital Details](https://huggingface.co/spaces/awacke1/California-Medical-Centers-Streamlit) |
|
- ποΈ [State of CA Attractions](https://huggingface.co/spaces/awacke1/Map-California-AI) |
|
- **Texas** |
|
- π₯ [State of TX Medical Centers](https://huggingface.co/spaces/awacke1/Streamlit-Google-Maps-Texas) |
|
- **New Jersey** |
|
- π₯ [State of NJ Hospitals](https://huggingface.co/spaces/awacke1/VizLib-TopLargeHospitalsNewJersey) |
|
## π Mythical and Historical Locations |
|
- **Iceland** |
|
- π° [Iceland Myth Places and Routes](https://huggingface.co/spaces/awacke1/Maps.Markers.Honor.Iceland) |
|
## πΊπΈ Specific US Data Searches |
|
- **NPI Registry Mental Health Provider Search** |
|
- π§ [NPI Registry Mental Health Provider Search and Cluster Map](https://huggingface.co/spaces/awacke1/Gradio-Maps-Latitude-Longitude) |
|
- **US City Specific Information** |
|
- π [US City FIPS code, Location, Population](https://huggingface.co/spaces/awacke1/CityFipsLocationandPopulation) |
|
""" |
|
st.markdown(MapInfo) |
|
return MapInfo |
|
|
|
|
|
ListMaps() |
|
|
|
|
|
|
|
states = ['MN', 'CA', 'WA', 'FL', 'TX', 'NY', 'NV'] |
|
icons = ['π¦', 'π΄', 'π', 'π', 'π€ ', 'π½', 'π°'] |
|
state_names = { |
|
'MN': 'Minnesota', 'CA': 'California', 'WA': 'Washington', |
|
'FL': 'Florida', 'TX': 'Texas', 'NY': 'New York', 'NV': 'Nevada' |
|
} |
|
|
|
|
|
def plot_state_outline(state_code, us_states_geojson, state_names): |
|
state_name = state_names.get(state_code, 'Unknown') |
|
fig = px.choropleth(locations=[state_name], geojson=us_states_geojson, |
|
featureidkey="properties.NAME", |
|
projection="mercator") |
|
fig.update_geos(fitbounds="locations", visible=False) |
|
fig.update_layout(title=f"{state_name} State Outline") |
|
st.plotly_chart(fig) |
|
|
|
|
|
us_states_geojson = "" |
|
def PlotOutlines(): |
|
geojson_path = 'gz_2010_us_040_00_500k.json' |
|
with open(geojson_path, 'r') as file: |
|
us_states_geojson = json.load(file) |
|
for state, icon in zip(states, icons): |
|
st.write(f"{icon} {state}") |
|
plot_state_outline(state, us_states_geojson, state_names) |
|
return us_states_geojson |
|
|
|
|
|
st.title('U.S. States Trivia πΊοΈ') |
|
|
|
for i, (state, icon) in enumerate(zip(states, icons)): |
|
st.markdown(f"{i + 1}. {state} {icon}") |
|
|
|
|
|
with st.expander(f"See Fascinating Facts about {state}"): |
|
text_to_speak = "" |
|
|
|
if state == 'MN': |
|
text_to_speak = """π¦ **Minnesota** |
|
ποΈ Known as the 'Land of 10,000 Lakes' |
|
π£ Famous for its fishing |
|
πΆ Boundary Waters offers incredible canoeing |
|
π Home to prestigious colleges |
|
βοΈ Cold winters but lovely summers |
|
π Largest city: Minneapolis |
|
π Walleye: The state fish |
|
π Home to the Minnesota Vikings.""" |
|
elif state == 'CA': |
|
text_to_speak = """π΄ **California** |
|
π Home to the Golden Gate Bridge |
|
π¬ Center of the American entertainment industry |
|
π Famous for Napa Valley's wine |
|
π² Home to Redwood National Park |
|
πββοΈ Excellent beaches and surf spots |
|
ποΈ Yosemite National Park: A natural wonder |
|
π΅ Death Valley: The hottest and driest area.""" |
|
elif state == 'WA': |
|
text_to_speak = """π **Washington** |
|
β Known for its coffee culture |
|
π» Home to Mount Rainier |
|
π Leading apple-producing state |
|
π Rich in seafood, especially salmon |
|
π§οΈ Known for its rainy weather |
|
π² Olympic National Park: Diverse ecosystems |
|
π Seattle: A tech hub and major city.""" |
|
elif state == 'FL': |
|
text_to_speak = """π **Florida** |
|
ποΈ Famous for its beaches |
|
π’ Home to various amusement parks like Disney World |
|
π Space launches from Cape Canaveral |
|
π Known for the Everglades and alligators |
|
π Major orange producer |
|
π The Keys: A series of tropical islands |
|
π° Miami: Known for its vibrant culture and nightlife.""" |
|
elif state == 'TX': |
|
text_to_speak = """π€ **Texas** |
|
π’οΈ Known for its oil and gas industry |
|
π Famous for its barbecue |
|
πΈ Rich musical heritage |
|
π Home to many cattle ranches |
|
π΅ Includes part of the Chihuahuan Desert |
|
π Big Bend National Park: Stunning night skies |
|
π Houston: Home to NASA's Johnson Space Center.""" |
|
elif state == 'NY': |
|
text_to_speak = """π½ **New York** |
|
ποΈ Home to New York City, the largest city in the U.S. |
|
π Known as the Big Apple |
|
π Major hub for arts and culture |
|
ποΈ Adirondack Mountains offer outdoor adventures |
|
π Famous for its style of pizza |
|
π Niagara Falls: A natural wonder |
|
ποΈ Finger Lakes: Known for wineries and beautiful scenery.""" |
|
elif state == 'NV': |
|
text_to_speak = """π° **Nevada** |
|
π Known for Las Vegas and its casinos |
|
ποΈ Includes part of the Mojave Desert |
|
πͺ Entertainment is a major industry |
|
π Known for the Hoover Dam |
|
π½ Area 51 is located here |
|
ποΈ Lake Tahoe: A stunning freshwater lake |
|
π Great Basin National Park: Known for its ancient bristlecone pines.""" |
|
|
|
st.markdown(text_to_speak) |
|
|
|
|
|
|
|
if st.button(f"π Read {state}'s Facts Aloud"): |
|
generate_speech_textarea(text_to_speak) |
|
|
|
|
|
MapInfo = ListMaps() |
|
|
|
us_states_geojson = PlotOutlines() |
|
|