awacke1 commited on
Commit
65f5ebd
Β·
1 Parent(s): 48e0a4e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -2
app.py CHANGED
@@ -1,6 +1,8 @@
1
  import streamlit as st
2
- st.markdown("""
3
 
 
 
 
4
 
5
  On the Virtues of Anthropomorphism and Empathy
6
  Introduction
@@ -38,4 +40,23 @@ In crafting this speech, the terms and concepts introduced in the semantic and e
38
 
39
  Thus, the speech serves as an example of how modern psychological terms and concepts can be integrated into classical ethical teachings to create a compelling and educational narrative. πŸ“šπŸ’«
40
 
41
- """)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
 
2
 
3
+ st.title("πŸ”Š Read It Aloud")
4
+
5
+ longText = """
6
 
7
  On the Virtues of Anthropomorphism and Empathy
8
  Introduction
 
40
 
41
  Thus, the speech serves as an example of how modern psychological terms and concepts can be integrated into classical ethical teachings to create a compelling and educational narrative. πŸ“šπŸ’«
42
 
43
+ """
44
+
45
+ st.markdown(longText)
46
+
47
+
48
+ text = st.text_area("Type the text you want to be read aloud here.", longText)
49
+
50
+ read_aloud_js = """
51
+ <button onclick="readAloud()">πŸ”Š Read Aloud</button>
52
+ <script type="text/javascript">
53
+ function readAloud() {
54
+ const text = document.getElementById("textArea").value;
55
+ const speech = new SpeechSynthesisUtterance(text);
56
+ window.speechSynthesis.speak(speech);
57
+ }
58
+ </script>
59
+ """
60
+
61
+ st.markdown(read_aloud_js, unsafe_allow_html=True)
62
+