rwitz commited on
Commit
a62bdda
β€’
1 Parent(s): 2098acb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -263,8 +263,9 @@ async def direct_chat(model, user_input, state, chatbot, character_name, charact
263
  state["direct_history"].append({"role": "bot", "content": response})
264
 
265
  return "", chatbot, state
266
- def reset_direct_chat():
267
- return [], gr.Textbox.update(value='')
 
268
  refresh_leaderboard()
269
  # Gradio interface setup
270
  # Gradio interface setup
@@ -328,7 +329,8 @@ with gr.Blocks() as demo:
328
  direct_regenerate_btn.click(direct_regenerate, inputs=[model_dropdown, direct_textbox, direct_chatbot, character_name, character_description, user_name], outputs=[direct_textbox, direct_chatbot])
329
  direct_textbox.submit(direct_chat, inputs=[model_dropdown, direct_textbox, state, direct_chatbot, character_name, character_description, user_name], outputs=[direct_textbox, direct_chatbot, state])
330
  direct_submit_btn.click(direct_chat, inputs=[model_dropdown, direct_textbox, state, direct_chatbot, character_name, character_description, user_name], outputs=[direct_textbox, direct_chatbot, state])
331
- direct_reset_btn.click(reset_direct_chat, None, [direct_chatbot, direct_textbox])
 
332
  with gr.Tab("πŸ† Leaderboard"):
333
  gr.Markdown("## πŸ“Š Check out the top-performing models!")
334
 
 
263
  state["direct_history"].append({"role": "bot", "content": response})
264
 
265
  return "", chatbot, state
266
+ def reset_direct_chat(state):
267
+ state["direct_history"] = []
268
+ return [], gr.Textbox.update(value=''), state
269
  refresh_leaderboard()
270
  # Gradio interface setup
271
  # Gradio interface setup
 
329
  direct_regenerate_btn.click(direct_regenerate, inputs=[model_dropdown, direct_textbox, direct_chatbot, character_name, character_description, user_name], outputs=[direct_textbox, direct_chatbot])
330
  direct_textbox.submit(direct_chat, inputs=[model_dropdown, direct_textbox, state, direct_chatbot, character_name, character_description, user_name], outputs=[direct_textbox, direct_chatbot, state])
331
  direct_submit_btn.click(direct_chat, inputs=[model_dropdown, direct_textbox, state, direct_chatbot, character_name, character_description, user_name], outputs=[direct_textbox, direct_chatbot, state])
332
+
333
+ direct_reset_btn.click(reset_direct_chat, inputs=[state], outputs=[direct_chatbot, direct_textbox, state])
334
  with gr.Tab("πŸ† Leaderboard"):
335
  gr.Markdown("## πŸ“Š Check out the top-performing models!")
336