Spaces:
Sleeping
Sleeping
vtrv.vls
commited on
Commit
·
8b5d332
1
Parent(s):
dfbdbad
Clear inputs on model change
Browse files
app.py
CHANGED
|
@@ -46,9 +46,8 @@ def model_gen(content, model_type: str, chat_history):
|
|
| 46 |
print(MODEL_LIB[model_type])
|
| 47 |
return gen(content, chat_history)
|
| 48 |
|
| 49 |
-
def
|
| 50 |
-
|
| 51 |
-
clear = gradio.ClearButton()
|
| 52 |
|
| 53 |
MODEL_LIB = {'RUBASE': giga_gen, 'TINYLLAMA': tiny_gen, 'QWEN2INS1B': qwen_gen}
|
| 54 |
|
|
@@ -57,11 +56,11 @@ def tab_arena():
|
|
| 57 |
with gradio.Column():
|
| 58 |
model_left = gradio.Dropdown(["TINYLLAMA", "QWEN2INS1B", "RUBASE"], value="TINYLLAMA", interactive=True, multiselect=False, label="Left model")
|
| 59 |
chatbot_left = gradio.Chatbot()
|
| 60 |
-
model_left.change(
|
| 61 |
with gradio.Column():
|
| 62 |
model_right = gradio.Dropdown(["TINYLLAMA", "QWEN2INS1B", "RUBASE"], value= "RUBASE", interactive=True, multiselect=False, label="Right model")
|
| 63 |
chatbot_right = gradio.Chatbot()
|
| 64 |
-
model_right.change(
|
| 65 |
|
| 66 |
with gradio.Row():
|
| 67 |
gradio.Button('Both Good')
|
|
|
|
| 46 |
print(MODEL_LIB[model_type])
|
| 47 |
return gen(content, chat_history)
|
| 48 |
|
| 49 |
+
def clear_chat(chatbot, msg):
|
| 50 |
+
return '', []
|
|
|
|
| 51 |
|
| 52 |
MODEL_LIB = {'RUBASE': giga_gen, 'TINYLLAMA': tiny_gen, 'QWEN2INS1B': qwen_gen}
|
| 53 |
|
|
|
|
| 56 |
with gradio.Column():
|
| 57 |
model_left = gradio.Dropdown(["TINYLLAMA", "QWEN2INS1B", "RUBASE"], value="TINYLLAMA", interactive=True, multiselect=False, label="Left model")
|
| 58 |
chatbot_left = gradio.Chatbot()
|
| 59 |
+
model_left.change(clear_chat, [chatbot_left, msg], [chatbot_left, msg])
|
| 60 |
with gradio.Column():
|
| 61 |
model_right = gradio.Dropdown(["TINYLLAMA", "QWEN2INS1B", "RUBASE"], value= "RUBASE", interactive=True, multiselect=False, label="Right model")
|
| 62 |
chatbot_right = gradio.Chatbot()
|
| 63 |
+
model_right.change(clear_chat, [chatbot_right, msg], [chatbot_right, msg])
|
| 64 |
|
| 65 |
with gradio.Row():
|
| 66 |
gradio.Button('Both Good')
|