Spaces:
Sleeping
Sleeping
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) | |