awacke1 commited on
Commit
0285ca1
Β·
verified Β·
1 Parent(s): 5609672

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -1
app.py CHANGED
@@ -1,6 +1,6 @@
1
  import streamlit as st
2
  st.video("Baby Gecko Learns Poetry.mp4")
3
- st.markdown("""
4
  Teaching a baby gecko poetry can be a fun and rewarding experience.
5
  You can start by reading poems out loud to the baby gecko,
6
  choosing simple and rhythmic poems that they can easily follow along with.
@@ -68,6 +68,43 @@ With the combination of storytelling, wordplay, and poetry, Baby Gecko Learns Po
68
 
69
  """)
70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  import streamlit as st
72
  import random
73
 
 
1
  import streamlit as st
2
  st.video("Baby Gecko Learns Poetry.mp4")
3
+ markdown=("""
4
  Teaching a baby gecko poetry can be a fun and rewarding experience.
5
  You can start by reading poems out loud to the baby gecko,
6
  choosing simple and rhythmic poems that they can easily follow along with.
 
68
 
69
  """)
70
 
71
+ st.markdwon(markdown)
72
+
73
+
74
+
75
+ # HTML5 based Speech Synthesis (Text to Speech in Browser)
76
+ @st.cache_resource
77
+ def SpeechSynthesis(result):
78
+ documentHTML5='''
79
+ <!DOCTYPE html>
80
+ <html>
81
+ <head>
82
+ <title>Read It Aloud</title>
83
+ <script type="text/javascript">
84
+ function readAloud() {
85
+ const text = document.getElementById("textArea").value;
86
+ const speech = new SpeechSynthesisUtterance(text);
87
+ window.speechSynthesis.speak(speech);
88
+ }
89
+ </script>
90
+ </head>
91
+ <body>
92
+ <h1>πŸ”Š Read It Aloud</h1>
93
+ <textarea id="textArea" rows="10" cols="80">
94
+ '''
95
+ documentHTML5 = documentHTML5 + result
96
+ documentHTML5 = documentHTML5 + '''
97
+ </textarea>
98
+ <br>
99
+ <button onclick="readAloud()">πŸ”Š Read Aloud</button>
100
+ </body>
101
+ </html>
102
+ '''
103
+ components.html(documentHTML5, width=1280, height=300)
104
+
105
+ SpeechSynthesis(markdown):
106
+
107
+
108
  import streamlit as st
109
  import random
110