Spaces:
Sleeping
Sleeping
broskicodes
commited on
Commit
·
8184257
1
Parent(s):
1923f0a
add header
Browse files
app.py
CHANGED
@@ -148,9 +148,10 @@ decode = lambda l: ''.join([itos[i] for i in l]) # decoder: take a list of integ
|
|
148 |
model = torch.load('complete-model.pt', map_location=device)
|
149 |
|
150 |
# inference
|
|
|
151 |
st.markdown('### Generation will be slow. Please be patient :)')
|
152 |
slider_value = st.slider('Amount of text to generate', min_value=100, max_value=2000, value=200, step=5)
|
153 |
-
if st.button('
|
154 |
context = torch.zeros((1, 1), dtype=torch.long, device=device)
|
155 |
text = model.generate(context, max_new_tokens=slider_value)[0].tolist()
|
156 |
st.text(decode(text))
|
|
|
148 |
model = torch.load('complete-model.pt', map_location=device)
|
149 |
|
150 |
# inference
|
151 |
+
st.markdown('## This is a simple lm for generating text in Skakespeareian style')
|
152 |
st.markdown('### Generation will be slow. Please be patient :)')
|
153 |
slider_value = st.slider('Amount of text to generate', min_value=100, max_value=2000, value=200, step=5)
|
154 |
+
if st.button('Generate text'):
|
155 |
context = torch.zeros((1, 1), dtype=torch.long, device=device)
|
156 |
text = model.generate(context, max_new_tokens=slider_value)[0].tolist()
|
157 |
st.text(decode(text))
|