File size: 770 Bytes
f311b28
 
 
 
 
 
 
 
 
 
 
 
 
 
d25f49e
f311b28
d25f49e
 
3c8a9bb
f311b28
 
 
 
 
 
 
 
 
 
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
import streamlit as st
import tensorflow as tf

st.markdown(
    """
    <h1 style='text-align: center; color: #4B8BBE; font-size: 48px;'>
        Next Character Prediction
    </h1>
    """,
    unsafe_allow_html=True
)

characters = st.text_input("Enter the characters to begin with")

epoch = st.radio("Enter the epoch value",['1','5','10','25','50','100','200'])

if characters and epoch:

    one_step_reloaded = tf.saved_model.load(f'model_epoch{epoch}')

    states = None
    next_char = tf.constant([characters])
    result = [next_char]
    
    for n in range(100):
        next_char, states = one_step_reloaded.generate_one_step(next_char, states=states)
        result.append(next_char)
    
    st.write(tf.strings.join(result)[0].numpy().decode("utf-8"))