awacke1 commited on
Commit
e8345f0
β€’
1 Parent(s): 3b1655c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -1,8 +1,9 @@
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>
7
  <html>
8
  <head>
@@ -25,7 +26,8 @@ def generate_html_with_textarea(text_to_speak):
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 = ['πŸͺ', 'πŸš€', 'πŸ€–', '🌌', 'πŸ§β€β™‚οΈ', 'πŸ—ΊοΈ', 'βš”οΈ', '🀝', '🦠', '🏭']
@@ -88,7 +90,8 @@ for i, (game, icon) in enumerate(zip(games, icons)):
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
 
 
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>
 
26
  </body>
27
  </html>
28
  '''
29
+ components.html(documentHTML5, width=1280, height=1024)
30
+
31
  # Game list and associated icons
32
  games = ['Terraforming Mars', 'Twilight Imperium (Fourth Edition)', 'Scythe', 'Eclipse', 'Small World', 'Risk Legacy', 'Axis & Allies', 'Diplomacy', 'Pandemic Legacy: Season 1', 'Brass: Birmingham']
33
  icons = ['πŸͺ', 'πŸš€', 'πŸ€–', '🌌', 'πŸ§β€β™‚οΈ', 'πŸ—ΊοΈ', 'βš”οΈ', '🀝', '🦠', '🏭']
 
90
 
91
  if st.button(f"πŸ”Š Read {game}'s Strategies Aloud"):
92
  st.markdown(text_to_speak)
93
+ generate_speech_textarea(text_to_speak)
94
+ #st.markdown(text, unsafe_allow_html=True)
95
 
96
 
97