tfedoseev commited on
Commit
2b86b0b
·
1 Parent(s): c6459ea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -18,11 +18,12 @@ st.title("Stupid jokes with transformers")
18
  st.write("Write question you want to see a funny answer for.")
19
  sent = st.text_area("Text", height = 100)
20
 
21
- max_source_length = 64
22
- max_target_length = 32
23
- prefix = "Answer the following question in a funny way: "
24
-
25
- input_ids = tokenizer(prefix + sent, max_length=max_source_length, truncation=True, return_tensors="pt").input_ids
26
- generated_sequence = infer(input_ids)
27
-
28
- st.write(generated_sequence)
 
 
18
  st.write("Write question you want to see a funny answer for.")
19
  sent = st.text_area("Text", height = 100)
20
 
21
+ if sent:
22
+ max_source_length = 64
23
+ max_target_length = 32
24
+ prefix = "Answer the following question in a funny way: "
25
+
26
+ input_ids = tokenizer(prefix + sent, max_length=max_source_length, truncation=True, return_tensors="pt").input_ids
27
+ generated_sequence = infer(input_ids)
28
+
29
+ st.write(generated_sequence)