Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import streamlit as st
|
2 |
|
3 |
-
# Function to generate HTML with textarea
|
4 |
def generate_html_with_textarea(text_to_speak):
|
5 |
return f'''
|
6 |
<!DOCTYPE html>
|
@@ -17,7 +17,7 @@ def generate_html_with_textarea(text_to_speak):
|
|
17 |
</head>
|
18 |
<body>
|
19 |
<h1>🔊 Read It Aloud</h1>
|
20 |
-
<textarea id="textArea" rows="10" cols="80">
|
21 |
{text_to_speak}
|
22 |
</textarea>
|
23 |
<br>
|
@@ -38,9 +38,10 @@ for i, (game, icon) in enumerate(zip(games, icons)):
|
|
38 |
|
39 |
# Expanders for each game to outline map rules or strategies
|
40 |
with st.expander(f"See Map Building & Gamification Strategy for {game}"):
|
41 |
-
# Defining text for each game's map strategy to use as a variable
|
42 |
text_to_speak = ""
|
43 |
-
|
|
|
|
|
44 |
if game == 'Terraforming Mars':
|
45 |
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."
|
46 |
st.markdown(text_to_speak)
|
@@ -81,6 +82,15 @@ for i, (game, icon) in enumerate(zip(games, icons)):
|
|
81 |
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."
|
82 |
st.markdown(text_to_speak)
|
83 |
|
84 |
-
#
|
|
|
|
|
|
|
85 |
if st.button(f"🔊 Read {game}'s Strategies Aloud"):
|
|
|
86 |
st.markdown(generate_html_with_textarea(text_to_speak), unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
|
3 |
+
# Function to generate HTML with textarea for speech synthesis
|
4 |
def generate_html_with_textarea(text_to_speak):
|
5 |
return f'''
|
6 |
<!DOCTYPE html>
|
|
|
17 |
</head>
|
18 |
<body>
|
19 |
<h1>🔊 Read It Aloud</h1>
|
20 |
+
<textarea id="textArea" rows="10" cols="80" readonly>
|
21 |
{text_to_speak}
|
22 |
</textarea>
|
23 |
<br>
|
|
|
38 |
|
39 |
# Expanders for each game to outline map rules or strategies
|
40 |
with st.expander(f"See Map Building & Gamification Strategy for {game}"):
|
|
|
41 |
text_to_speak = ""
|
42 |
+
|
43 |
+
# ... Cut here for content change!
|
44 |
+
|
45 |
if game == 'Terraforming Mars':
|
46 |
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."
|
47 |
st.markdown(text_to_speak)
|
|
|
82 |
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."
|
83 |
st.markdown(text_to_speak)
|
84 |
|
85 |
+
# ... Cut here for content change!
|
86 |
+
|
87 |
+
|
88 |
+
|
89 |
if st.button(f"🔊 Read {game}'s Strategies Aloud"):
|
90 |
+
st.markdown(text_to_speak)
|
91 |
st.markdown(generate_html_with_textarea(text_to_speak), unsafe_allow_html=True)
|
92 |
+
|
93 |
+
|
94 |
+
|
95 |
+
|
96 |
+
|