Update backupapp.py
Browse files- backupapp.py +43 -57
backupapp.py
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
import streamlit as st
|
2 |
import streamlit.components.v1 as components
|
|
|
|
|
3 |
|
4 |
# Function to generate HTML with textarea for speech synthesis
|
5 |
def generate_speech_textarea(text_to_speak):
|
@@ -27,66 +29,50 @@ def generate_speech_textarea(text_to_speak):
|
|
27 |
</body>
|
28 |
</html>
|
29 |
'''
|
30 |
-
components.html(documentHTML5, width=1280, height=
|
31 |
-
|
32 |
-
#
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
# Main code
|
37 |
-
st.title('
|
38 |
|
39 |
-
for i, (
|
40 |
-
st.markdown(f"{i + 1}. {
|
41 |
|
42 |
-
# Expanders for each
|
43 |
-
with st.expander(f"See
|
44 |
text_to_speak = ""
|
45 |
-
|
46 |
-
# ... Cut here for content change!
|
47 |
-
|
48 |
-
if game == 'Terraforming Mars':
|
49 |
-
text_to_speak = "πͺπ‘ **Terraforming Mars** \n1οΈβ£ π±π§ Opt for plant-heavy and water tiles \n2οΈβ£ ππ Position factories near volcanic areas \n3οΈβ£ ππ‘ Control key parameters and energy grid \n4οΈβ£ π€οΈπ‘οΈ Connect colonies and temperature control \n5οΈβ£ ππ― Upgrade spaceports and aim for synergies."
|
50 |
-
st.markdown(text_to_speak)
|
51 |
-
|
52 |
-
elif game == 'Twilight Imperium (Fourth Edition)':
|
53 |
-
text_to_speak = "ππ **Twilight Imperium** \n1οΈβ£ πβοΈ Position fleets in strategic nebulas and balance resources \n2οΈβ£ π°π‘οΈ Fortify chokepoints and use PDS systems \n3οΈβ£ ππ Effective trade routes and wormhole caution \n4οΈβ£ ππ Prioritize Mecatol Rex and moon attacks \n5οΈβ£ π οΈπ€ Optimize unit upgrades and forge alliances."
|
54 |
-
st.markdown(text_to_speak)
|
55 |
-
|
56 |
-
elif game == 'Scythe':
|
57 |
-
text_to_speak = "π€ποΈ **Scythe** \n1οΈβ£ ποΈπ οΈ Choose starting positions and factory cards \n2οΈβ£ πΊοΈπ Be aware of neighbors and control rivers \n3οΈβ£ ππ‘οΈ Maximize resource buildings and backdoor defense \n4οΈβ£ π―πΎ Focus objectives and manage food \n5οΈβ£ π²π Play probabilities and hunt treasures."
|
58 |
-
st.markdown(text_to_speak)
|
59 |
|
60 |
-
|
61 |
-
text_to_speak = "
|
62 |
-
|
63 |
-
|
64 |
-
elif
|
65 |
-
text_to_speak = "
|
66 |
-
|
67 |
-
|
68 |
-
elif
|
69 |
-
text_to_speak = "
|
70 |
-
|
71 |
-
|
72 |
-
elif
|
73 |
-
text_to_speak = "
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
elif game == 'Pandemic Legacy: Season 1':
|
81 |
-
text_to_speak = "π¦ π **Pandemic Legacy** \n1οΈβ£ π¦ π¬ Cure research and outbreak control \n2οΈβ£ ππ Global movement and airlifts \n3οΈβ£ π₯π‘οΈ Build research stations and quarantine \n4οΈβ£ ππ― Complete objectives and bonus cards \n5οΈβ£ π€π Teamwork and role synergy."
|
82 |
-
st.markdown(text_to_speak)
|
83 |
-
|
84 |
-
elif game == 'Brass: Birmingham':
|
85 |
-
text_to_speak = "ππ€οΈ **Brass Birmingham** \n1οΈβ£ ππ€οΈ Industry and canal routes \n2οΈβ£ ππΊ Economic management and beer supply \n3οΈβ£ π οΈπΊοΈ Optimize developments and map control \n4οΈβ£ π€π‘ Partnerships and market strategy \n5οΈβ£ ππ Railroads and victory points."
|
86 |
-
st.markdown(text_to_speak)
|
87 |
-
|
88 |
-
# ... Cut here for content change!
|
89 |
-
|
90 |
-
if st.button(f"π Read {game}'s Strategies Aloud"):
|
91 |
-
st.markdown(text_to_speak)
|
92 |
-
generate_speech_textarea(text_to_speak)
|
|
|
1 |
import streamlit as st
|
2 |
import streamlit.components.v1 as components
|
3 |
+
import geopandas as gpd
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
|
6 |
# Function to generate HTML with textarea for speech synthesis
|
7 |
def generate_speech_textarea(text_to_speak):
|
|
|
29 |
</body>
|
30 |
</html>
|
31 |
'''
|
32 |
+
components.html(documentHTML5, width=1280, height=500)
|
33 |
+
|
34 |
+
# Function to display the state outline
|
35 |
+
def plot_state_outline(state_code):
|
36 |
+
# Read U.S. geometries file
|
37 |
+
gdf = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
|
38 |
+
# Filter data for the given state
|
39 |
+
gdf_state = gdf[gdf['iso_a3'] == 'USA']
|
40 |
+
# Plot the geometry
|
41 |
+
ax = gdf_state.boundary.plot()
|
42 |
+
plt.title(f"{state_code} State Outline")
|
43 |
+
st.pyplot(plt)
|
44 |
+
|
45 |
+
# States list and associated icons
|
46 |
+
states = ['MN', 'CA', 'WA', 'FL', 'TX', 'NY', 'NV']
|
47 |
+
icons = ['π¦', 'π΄', 'π', 'π', 'π€ ', 'π½', 'π°']
|
48 |
|
49 |
# Main code
|
50 |
+
st.title('U.S. States Trivia πΊοΈ')
|
51 |
|
52 |
+
for i, (state, icon) in enumerate(zip(states, icons)):
|
53 |
+
st.markdown(f"{i + 1}. {state} {icon}")
|
54 |
|
55 |
+
# Expanders for each state to outline fascinating facts
|
56 |
+
with st.expander(f"See Fascinating Facts about {state}"):
|
57 |
text_to_speak = ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
+
if state == 'MN':
|
60 |
+
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."
|
61 |
+
elif state == 'CA':
|
62 |
+
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."
|
63 |
+
elif state == 'WA':
|
64 |
+
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."
|
65 |
+
elif state == 'FL':
|
66 |
+
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."
|
67 |
+
elif state == 'TX':
|
68 |
+
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."
|
69 |
+
elif state == 'NY':
|
70 |
+
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."
|
71 |
+
elif state == 'NV':
|
72 |
+
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."
|
73 |
+
|
74 |
+
st.markdown(text_to_speak)
|
75 |
+
plot_state_outline(state)
|
76 |
+
|
77 |
+
if st.button(f"π Read {state}'s Facts Aloud"):
|
78 |
+
generate_speech_textarea(text_to_speak)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|