krrishD commited on
Commit
970883c
β€’
1 Parent(s): 300207f

now the user input box is also cleared upon input, making it easier to have follow up conversations

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -262,6 +262,9 @@ def chat(message, history):
262
  print("response: ", response)
263
  history.append((message, response))
264
  return history, history
 
 
 
265
 
266
  with gr.Blocks() as demo:
267
  user_state=gr.State([])
@@ -273,6 +276,7 @@ with gr.Blocks() as demo:
273
  output = gr.Chatbot().style(color_map=("green", "pink"))
274
  # allow_flagging="never",
275
  btn.click(chat, [inp, user_state], [output, user_state])
 
276
  gr.Markdown("""### need help? got feedback? have thoughts? etc. ➜ Join the [Discord](https://discord.gg/KvG3azf39U)""")
277
 
278
  if __name__ == "__main__":
 
262
  print("response: ", response)
263
  history.append((message, response))
264
  return history, history
265
+
266
+ def clear(arg):
267
+ return "Enter your response - feel free to elaborate further, ask questions, etc."
268
 
269
  with gr.Blocks() as demo:
270
  user_state=gr.State([])
 
276
  output = gr.Chatbot().style(color_map=("green", "pink"))
277
  # allow_flagging="never",
278
  btn.click(chat, [inp, user_state], [output, user_state])
279
+ btn.click(clear, inp, inp)
280
  gr.Markdown("""### need help? got feedback? have thoughts? etc. ➜ Join the [Discord](https://discord.gg/KvG3azf39U)""")
281
 
282
  if __name__ == "__main__":