Spaces:
Runtime error
Runtime error
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) | |