Spaces:
Runtime error
Runtime error
Commit
·
07843c2
1
Parent(s):
8eb83cc
Update app.py
Browse files
app.py
CHANGED
@@ -19,8 +19,10 @@ def get_model():
|
|
19 |
|
20 |
model, tokenizer = get_model()
|
21 |
g = "life is a"
|
|
|
22 |
with st.form(key='my_form'):
|
23 |
prompt = st.text_area(label='Enter sentence', value=g)
|
|
|
24 |
submit_button = st.form_submit_button(label='Submit')
|
25 |
if submit_button:
|
26 |
with torch.no_grad():
|
@@ -35,5 +37,6 @@ with st.form(key='my_form'):
|
|
35 |
best_words = [tokenizer.decode([idx.item()]) for idx in best_indices]
|
36 |
text.append(best_indices[0].item())
|
37 |
best_probabilities = probabilities[best_indices].tolist()
|
38 |
-
words = []
|
39 |
-
|
|
|
|
19 |
|
20 |
model, tokenizer = get_model()
|
21 |
g = "life is a"
|
22 |
+
c = 5
|
23 |
with st.form(key='my_form'):
|
24 |
prompt = st.text_area(label='Enter sentence', value=g)
|
25 |
+
prompt = st.text_area(label='Enter Number of words', value=c)
|
26 |
submit_button = st.form_submit_button(label='Submit')
|
27 |
if submit_button:
|
28 |
with torch.no_grad():
|
|
|
37 |
best_words = [tokenizer.decode([idx.item()]) for idx in best_indices]
|
38 |
text.append(best_indices[0].item())
|
39 |
best_probabilities = probabilities[best_indices].tolist()
|
40 |
+
words = []
|
41 |
+
final_string = ' '.join(best_words[c])
|
42 |
+
st.write(final_string)
|