Eudaimonia / app.2.py
awacke1's picture
Create app.2.py
48e0a4e
raw
history blame contribute delete
518 Bytes
import streamlit as st
st.title("πŸ”Š Read It Aloud")
text = st.text_area("Type the text you want to be read aloud here.", "Hello, world!")
read_aloud_js = """
<button onclick="readAloud()">πŸ”Š Read Aloud</button>
<script type="text/javascript">
function readAloud() {
const text = document.getElementById("textArea").value;
const speech = new SpeechSynthesisUtterance(text);
window.speechSynthesis.speak(speech);
}
</script>
"""
st.markdown(read_aloud_js, unsafe_allow_html=True)