awacke1 commited on
Commit
48e0a4e
Β·
1 Parent(s): 9241b02

Create app.2.py

Browse files
Files changed (1) hide show
  1. app.2.py +18 -0
app.2.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ st.title("πŸ”Š Read It Aloud")
4
+
5
+ text = st.text_area("Type the text you want to be read aloud here.", "Hello, world!")
6
+
7
+ read_aloud_js = """
8
+ <button onclick="readAloud()">πŸ”Š Read Aloud</button>
9
+ <script type="text/javascript">
10
+ function readAloud() {
11
+ const text = document.getElementById("textArea").value;
12
+ const speech = new SpeechSynthesisUtterance(text);
13
+ window.speechSynthesis.speak(speech);
14
+ }
15
+ </script>
16
+ """
17
+
18
+ st.markdown(read_aloud_js, unsafe_allow_html=True)