Update backupapp.py
Browse files- backupapp.py +16 -10
backupapp.py
CHANGED
@@ -1,8 +1,9 @@
|
|
1 |
import streamlit as st
|
|
|
2 |
|
3 |
-
# Function to generate HTML with textarea
|
4 |
-
def
|
5 |
-
|
6 |
<!DOCTYPE html>
|
7 |
<html>
|
8 |
<head>
|
@@ -17,15 +18,17 @@ 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 |
-
|
|
|
22 |
</textarea>
|
23 |
<br>
|
24 |
<button onclick="readAloud()">π Read Aloud</button>
|
25 |
</body>
|
26 |
</html>
|
27 |
'''
|
28 |
-
|
|
|
29 |
# Game list and associated icons
|
30 |
games = ['Terraforming Mars', 'Twilight Imperium (Fourth Edition)', 'Scythe', 'Eclipse', 'Small World', 'Risk Legacy', 'Axis & Allies', 'Diplomacy', 'Pandemic Legacy: Season 1', 'Brass: Birmingham']
|
31 |
icons = ['πͺ', 'π', 'π€', 'π', 'π§ββοΈ', 'πΊοΈ', 'βοΈ', 'π€', 'π¦ ', 'π']
|
@@ -38,9 +41,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 +85,8 @@ 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(
|
|
|
|
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):
|
6 |
+
documentHTML5 = '''
|
7 |
<!DOCTYPE html>
|
8 |
<html>
|
9 |
<head>
|
|
|
18 |
</head>
|
19 |
<body>
|
20 |
<h1>π Read It Aloud</h1>
|
21 |
+
<textarea id="textArea" rows="10" cols="80" readonly>'''
|
22 |
+
documentHTML5 = documentHTML5 + text_to_speak
|
23 |
+
documentHTML5 = documentHTML5 + '''
|
24 |
</textarea>
|
25 |
<br>
|
26 |
<button onclick="readAloud()">π Read Aloud</button>
|
27 |
</body>
|
28 |
</html>
|
29 |
'''
|
30 |
+
components.html(documentHTML5, width=1280, height=1024)
|
31 |
+
|
32 |
# Game list and associated icons
|
33 |
games = ['Terraforming Mars', 'Twilight Imperium (Fourth Edition)', 'Scythe', 'Eclipse', 'Small World', 'Risk Legacy', 'Axis & Allies', 'Diplomacy', 'Pandemic Legacy: Season 1', 'Brass: Birmingham']
|
34 |
icons = ['πͺ', 'π', 'π€', 'π', 'π§ββοΈ', 'πΊοΈ', 'βοΈ', 'π€', 'π¦ ', 'π']
|
|
|
41 |
|
42 |
# Expanders for each game to outline map rules or strategies
|
43 |
with st.expander(f"See Map Building & Gamification Strategy for {game}"):
|
|
|
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)
|
|
|
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)
|