zakerytclarke commited on
Commit
082ecc3
·
verified ·
1 Parent(s): a2373c5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -10
app.py CHANGED
@@ -334,27 +334,25 @@ def main():
334
 
335
  s1, s2, s3 = st.columns([1, 1, 1])
336
 
337
- user_input = None
338
 
339
  with s1:
340
  if st.button(choice1, use_container_width=True):
341
- user_input = choice1
342
 
343
  with s2:
344
  if st.button(choice2, use_container_width=True):
345
- user_input = choice2
346
 
347
  with s3:
348
  if st.button(choice3, use_container_width=True):
349
- user_input = choice3
350
 
351
- # Also allow user input through text box
352
- if not user_input:
353
- user_input = st.chat_input("Ask me anything")
354
 
355
- if user_input:
356
- with st.spinner('Generating Response...'):
357
- response = handle_chat(user_prompt, user_input, teapot_ai)
358
 
359
 
360
  if __name__ == "__main__":
 
334
 
335
  s1, s2, s3 = st.columns([1, 1, 1])
336
 
337
+ user_suggested_input = None
338
 
339
  with s1:
340
  if st.button(choice1, use_container_width=True):
341
+ user_suggested_input = choice1
342
 
343
  with s2:
344
  if st.button(choice2, use_container_width=True):
345
+ user_suggested_input = choice2
346
 
347
  with s3:
348
  if st.button(choice3, use_container_width=True):
349
+ user_suggested_input = choice3
350
 
351
+ user_input = st.chat_input("Ask me anything")
 
 
352
 
353
+
354
+ with st.spinner('Generating Response...'):
355
+ response = handle_chat(user_prompt, user_suggested_input or user_input, teapot_ai)
356
 
357
 
358
  if __name__ == "__main__":