Spaces:
Runtime error
Runtime error
File size: 1,009 Bytes
d9fd3a9 0597335 d9fd3a9 09bc440 0597335 09bc440 5e220ec |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
import streamlit as st
documentHTML5='''
<!DOCTYPE html>
<html>
<head>
<title>Read It Aloud</title>
<script type="text/javascript">
function readAloud() {
const text = document.getElementById("textArea").value;
const speech = new SpeechSynthesisUtterance(text);
window.speechSynthesis.speak(speech);
}
</script>
</head>
<body>
<h1>π Read It Aloud</h1>
<textarea id="textArea" rows="10" cols="80">
This is a text passage that will be read aloud if Streamlit wrapping HTML5 wrapping browser based speech works correctly.
If all works this html can be nested into a variable and then put into session using streamlit and HTML5.
</textarea>
<br>
<button onclick="readAloud()">π Read Aloud</button>
</body>
</html>
'''
import streamlit.components.v1 as components # Import Streamlit
components.html(documentHTML5, width=1280, height=1024)
#st.markdown(documentHTML5, unsafe_allow_html=True)
#st.html(documentHTML5)
|