Spaces:
Sleeping
Sleeping
Update streamlit_app.py
Browse files- streamlit_app.py +27 -25
streamlit_app.py
CHANGED
|
@@ -1,25 +1,27 @@
|
|
| 1 |
-
import streamlit as st
|
| 2 |
-
import tensorflow as tf
|
| 3 |
-
|
| 4 |
-
st.markdown(
|
| 5 |
-
"""
|
| 6 |
-
<h1 style='text-align: center; color: #4B8BBE; font-size: 48px;'>
|
| 7 |
-
Next Character Prediction
|
| 8 |
-
</h1>
|
| 9 |
-
""",
|
| 10 |
-
unsafe_allow_html=True
|
| 11 |
-
)
|
| 12 |
-
|
| 13 |
-
characters = st.text_input("Enter the characters to begin with")
|
| 14 |
-
|
| 15 |
-
one_step_reloaded = tf.saved_model.load('reonestep20F')
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import tensorflow as tf
|
| 3 |
+
|
| 4 |
+
st.markdown(
|
| 5 |
+
"""
|
| 6 |
+
<h1 style='text-align: center; color: #4B8BBE; font-size: 48px;'>
|
| 7 |
+
Next Character Prediction
|
| 8 |
+
</h1>
|
| 9 |
+
""",
|
| 10 |
+
unsafe_allow_html=True
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
+
characters = st.text_input("Enter the characters to begin with")
|
| 14 |
+
|
| 15 |
+
one_step_reloaded = tf.saved_model.load('reonestep20F')
|
| 16 |
+
|
| 17 |
+
if characters:
|
| 18 |
+
|
| 19 |
+
states = None
|
| 20 |
+
next_char = tf.constant([characters])
|
| 21 |
+
result = [next_char]
|
| 22 |
+
|
| 23 |
+
for n in range(100):
|
| 24 |
+
next_char, states = one_step_reloaded.generate_one_step(next_char, states=states)
|
| 25 |
+
result.append(next_char)
|
| 26 |
+
|
| 27 |
+
st.write(tf.strings.join(result)[0].numpy().decode("utf-8"))
|