awacke1 commited on
Commit
1fd0d56
β€’
1 Parent(s): 7b2dd92

Update backupapp.py

Browse files
Files changed (1) hide show
  1. 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 generate_html_with_textarea(text_to_speak):
5
- return f'''
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
- {text_to_speak}
 
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
- # Button to read the strategies aloud
 
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
+ 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)