Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
|
|
|
| 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 |
-
|
|
|
|
| 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 |
|