Spaces:
Sleeping
Sleeping
vtrv.vls
commited on
Commit
·
59904b9
1
Parent(s):
6934609
Clear inputs on model change
Browse files
app.py
CHANGED
|
@@ -40,6 +40,8 @@ def qwen_gen(content, chat_history):
|
|
| 40 |
return '', chat_history
|
| 41 |
|
| 42 |
def model_gen(content, model_type: str, chat_history):
|
|
|
|
|
|
|
| 43 |
gen = MODEL_LIB[model_type]
|
| 44 |
print(MODEL_LIB[model_type])
|
| 45 |
return gen(content, chat_history)
|
|
@@ -56,11 +58,11 @@ def tab_arena():
|
|
| 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(
|
| 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(
|
| 64 |
|
| 65 |
with gradio.Row():
|
| 66 |
gradio.Button('Both Good')
|
|
|
|
| 40 |
return '', chat_history
|
| 41 |
|
| 42 |
def model_gen(content, model_type: str, chat_history):
|
| 43 |
+
if content is None:
|
| 44 |
+
return None, None
|
| 45 |
gen = MODEL_LIB[model_type]
|
| 46 |
print(MODEL_LIB[model_type])
|
| 47 |
return gen(content, chat_history)
|
|
|
|
| 58 |
with gradio.Column():
|
| 59 |
model_left = gradio.Dropdown(["TINYLLAMA", "QWEN2INS1B", "RUBASE"], value="TINYLLAMA", interactive=True, multiselect=False, label="Left model")
|
| 60 |
chatbot_left = gradio.Chatbot()
|
| 61 |
+
model_left.change(model_gen, [None, model_left, None], [None, None])
|
| 62 |
with gradio.Column():
|
| 63 |
model_right = gradio.Dropdown(["TINYLLAMA", "QWEN2INS1B", "RUBASE"], value= "RUBASE", interactive=True, multiselect=False, label="Right model")
|
| 64 |
chatbot_right = gradio.Chatbot()
|
| 65 |
+
model_right.change(model_gen, [None, model_right, None], [None, None])
|
| 66 |
|
| 67 |
with gradio.Row():
|
| 68 |
gradio.Button('Both Good')
|