Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ 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):
|
|
|
6 |
documentHTML5 = '''
|
7 |
<!DOCTYPE html>
|
8 |
<html>
|
@@ -47,46 +48,27 @@ for i, (game, icon) in enumerate(zip(games, icons)):
|
|
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 |
elif game == 'Eclipse':
|
61 |
text_to_speak = "ππ **Eclipse** \n1οΈβ£ ππ Control sectors and central hexes \n2οΈβ£ πΈπ‘οΈ Build formidable fleets and defenses \n3οΈβ£ ππ Prioritize production and research \n4οΈβ£ π€π Trade and diplomacy \n5οΈβ£ ππ Wormhole travel and expansion speed."
|
62 |
-
st.markdown(text_to_speak)
|
63 |
-
|
64 |
elif game == 'Small World':
|
65 |
text_to_speak = "π§ββοΈπ **Small World** \n1οΈβ£ πΊοΈπ Choose realms and races wisely \n2οΈβ£ ππ‘οΈ Exploit powers and defend territories \n3οΈβ£ ππ Collect victory coins and treasures \n4οΈβ£ π€π Forge short alliances and occupy mountains \n5οΈβ£ ππ° Know when to decline and occupy forts."
|
66 |
-
st.markdown(text_to_speak)
|
67 |
-
|
68 |
elif game == 'Risk Legacy':
|
69 |
text_to_speak = "πΊοΈβοΈ **Risk Legacy** \n1οΈβ£ πΊοΈβοΈ Control continents and aggressive expansion \n2οΈβ£ π‘οΈπ Fortify borders and use fortresses \n3οΈβ£ ππ Complete missions and airfields \n4οΈβ£ ππ₯ Collect victory points and scorched earth \n5οΈβ£ π€π Alliances and betrayal."
|
70 |
-
st.markdown(text_to_speak)
|
71 |
-
|
72 |
elif game == 'Axis & Allies':
|
73 |
text_to_speak = "βοΈπ **Axis & Allies** \n1οΈβ£ βοΈπ Strategic frontlines and global dominance \n2οΈβ£ ππ Resource management and economy \n3οΈβ£ π‘οΈπ’ Naval blockades and fortress defenses \n4οΈβ£ ποΈπ― Focused objectives and key battles \n5οΈβ£ π€π₯ Alliances and surprise attacks."
|
74 |
-
st.markdown(text_to_speak)
|
75 |
-
|
76 |
elif game == 'Diplomacy':
|
77 |
text_to_speak = "π€π **Diplomacy** \n1οΈβ£ π€π Negotiation and written orders \n2οΈβ£ πΊοΈπ‘οΈ Strategic positioning and defenses \n3οΈβ£ π’β Naval forces and chokepoints \n4οΈβ£ π°π Territory control and key regions \n5οΈβ£ ππ Timing and deception."
|
78 |
st.markdown(text_to_speak)
|
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 |
-
|
92 |
-
generate_speech_textarea(text_to_speak)
|
|
|
3 |
|
4 |
# Function to generate HTML with textarea for speech synthesis
|
5 |
def generate_speech_textarea(text_to_speak):
|
6 |
+
#st.markdown(text_to_speak)
|
7 |
documentHTML5 = '''
|
8 |
<!DOCTYPE html>
|
9 |
<html>
|
|
|
48 |
|
49 |
if game == 'Terraforming Mars':
|
50 |
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."
|
|
|
|
|
51 |
elif game == 'Twilight Imperium (Fourth Edition)':
|
52 |
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."
|
|
|
|
|
53 |
elif game == 'Scythe':
|
54 |
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."
|
|
|
|
|
55 |
elif game == 'Eclipse':
|
56 |
text_to_speak = "ππ **Eclipse** \n1οΈβ£ ππ Control sectors and central hexes \n2οΈβ£ πΈπ‘οΈ Build formidable fleets and defenses \n3οΈβ£ ππ Prioritize production and research \n4οΈβ£ π€π Trade and diplomacy \n5οΈβ£ ππ Wormhole travel and expansion speed."
|
|
|
|
|
57 |
elif game == 'Small World':
|
58 |
text_to_speak = "π§ββοΈπ **Small World** \n1οΈβ£ πΊοΈπ Choose realms and races wisely \n2οΈβ£ ππ‘οΈ Exploit powers and defend territories \n3οΈβ£ ππ Collect victory coins and treasures \n4οΈβ£ π€π Forge short alliances and occupy mountains \n5οΈβ£ ππ° Know when to decline and occupy forts."
|
|
|
|
|
59 |
elif game == 'Risk Legacy':
|
60 |
text_to_speak = "πΊοΈβοΈ **Risk Legacy** \n1οΈβ£ πΊοΈβοΈ Control continents and aggressive expansion \n2οΈβ£ π‘οΈπ Fortify borders and use fortresses \n3οΈβ£ ππ Complete missions and airfields \n4οΈβ£ ππ₯ Collect victory points and scorched earth \n5οΈβ£ π€π Alliances and betrayal."
|
|
|
|
|
61 |
elif game == 'Axis & Allies':
|
62 |
text_to_speak = "βοΈπ **Axis & Allies** \n1οΈβ£ βοΈπ Strategic frontlines and global dominance \n2οΈβ£ ππ Resource management and economy \n3οΈβ£ π‘οΈπ’ Naval blockades and fortress defenses \n4οΈβ£ ποΈπ― Focused objectives and key battles \n5οΈβ£ π€π₯ Alliances and surprise attacks."
|
|
|
|
|
63 |
elif game == 'Diplomacy':
|
64 |
text_to_speak = "π€π **Diplomacy** \n1οΈβ£ π€π Negotiation and written orders \n2οΈβ£ πΊοΈπ‘οΈ Strategic positioning and defenses \n3οΈβ£ π’β Naval forces and chokepoints \n4οΈβ£ π°π Territory control and key regions \n5οΈβ£ ππ Timing and deception."
|
65 |
st.markdown(text_to_speak)
|
|
|
66 |
elif game == 'Pandemic Legacy: Season 1':
|
67 |
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."
|
|
|
|
|
68 |
elif game == 'Brass: Birmingham':
|
69 |
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."
|
|
|
70 |
|
71 |
# ... Cut here for content change!
|
72 |
|
73 |
if st.button(f"π Read {game}'s Strategies Aloud"):
|
74 |
+
generate_speech_textarea(text_to_speak)
|
|