Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -132,6 +132,44 @@ def StreamLLMChatResponse(prompt):
|
|
| 132 |
|
| 133 |
except:
|
| 134 |
st.write('Stream llm issue')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
return result
|
| 136 |
except:
|
| 137 |
st.write('DromeLlama is asleep. Starting up now on A10 - please give 5 minutes then retry as KEDA scales up from zero to activate running container(s).')
|
|
|
|
| 132 |
|
| 133 |
except:
|
| 134 |
st.write('Stream llm issue')
|
| 135 |
+
|
| 136 |
+
documentHTML5='''
|
| 137 |
+
<!DOCTYPE html>
|
| 138 |
+
<html>
|
| 139 |
+
<head>
|
| 140 |
+
<title>Read It Aloud</title>
|
| 141 |
+
<script type="text/javascript">
|
| 142 |
+
function readAloud() {
|
| 143 |
+
const text = document.getElementById("textArea").value;
|
| 144 |
+
const speech = new SpeechSynthesisUtterance(text);
|
| 145 |
+
window.speechSynthesis.speak(speech);
|
| 146 |
+
}
|
| 147 |
+
</script>
|
| 148 |
+
</head>
|
| 149 |
+
<body>
|
| 150 |
+
<h1>🔊 Read It Aloud</h1>
|
| 151 |
+
<textarea id="textArea" rows="10" cols="80">
|
| 152 |
+
'''
|
| 153 |
+
|
| 154 |
+
documentHTML5 = documentHTML5 + result
|
| 155 |
+
|
| 156 |
+
documentHTML5 = documentHTML5 + '''
|
| 157 |
+
This is a text passage that will be read aloud if Streamlit wrapping HTML5 wrapping browser based speech works correctly.
|
| 158 |
+
|
| 159 |
+
If all works this html can be nested into a variable and then put into session using streamlit and HTML5.
|
| 160 |
+
|
| 161 |
+
</textarea>
|
| 162 |
+
<br>
|
| 163 |
+
<button onclick="readAloud()">🔊 Read Aloud</button>
|
| 164 |
+
</body>
|
| 165 |
+
</html>
|
| 166 |
+
'''
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
import streamlit.components.v1 as components # Import Streamlit
|
| 170 |
+
components.html(documentHTML5, width=1280, height=1024)
|
| 171 |
+
|
| 172 |
+
|
| 173 |
return result
|
| 174 |
except:
|
| 175 |
st.write('DromeLlama is asleep. Starting up now on A10 - please give 5 minutes then retry as KEDA scales up from zero to activate running container(s).')
|