Mel Nguyen (she/her) commited on
Commit
8529353
1 Parent(s): 04e7e8d

add button

Browse files
Files changed (1) hide show
  1. app.py +10 -9
app.py CHANGED
@@ -36,12 +36,13 @@ max_length = st.sidebar.slider("Max Length", min_value = 10, max_value=500)
36
  #top_k = st.sidebar.slider("Top-k", min_value = 0, max_value=5, value = 0)
37
  #top_p = st.sidebar.slider("Top-p", min_value = 0.0, max_value=1.0, step = 0.05, value = 0.9)
38
 
39
- encoded_prompt = tokenizer.encode(sent, add_special_tokens=False, return_tensors="pt")
40
- if encoded_prompt.size()[-1] == 0:
41
- input_ids = None
42
- else:
43
- input_ids = encoded_prompt
44
-
45
- gen_tokens = infer(encoded_prompt, max_length)
46
- gen_text = tokenizer.batch_decode(gen_tokens)[0]
47
- st.write(gen_text)
 
 
36
  #top_k = st.sidebar.slider("Top-k", min_value = 0, max_value=5, value = 0)
37
  #top_p = st.sidebar.slider("Top-p", min_value = 0.0, max_value=1.0, step = 0.05, value = 0.9)
38
 
39
+ if st.button("Generate Text"):
40
+ encoded_prompt = tokenizer.encode(sent, add_special_tokens=False, return_tensors="pt")
41
+ if encoded_prompt.size()[-1] == 0:
42
+ input_ids = None
43
+ else:
44
+ input_ids = encoded_prompt
45
+
46
+ gen_tokens = infer(encoded_prompt, max_length)
47
+ gen_text = tokenizer.batch_decode(gen_tokens)[0]
48
+ st.write(gen_text)