Spaces:
Sleeping
Sleeping
vtrv.vls
commited on
Commit
·
d629b6c
1
Parent(s):
8b5d332
Clear inputs on model change
Browse files
app.py
CHANGED
@@ -47,7 +47,7 @@ def model_gen(content, model_type: str, chat_history):
|
|
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,11 +56,9 @@ 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(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')
|
@@ -71,8 +69,11 @@ def tab_arena():
|
|
71 |
msg = gradio.Textbox()
|
72 |
clear = gradio.ClearButton([msg, chatbot_left, chatbot_right])
|
73 |
|
74 |
-
|
75 |
-
|
|
|
|
|
|
|
76 |
|
77 |
# with gradio.Column():
|
78 |
# gradio.ChatInterface(
|
|
|
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 |
with gradio.Column():
|
60 |
model_right = gradio.Dropdown(["TINYLLAMA", "QWEN2INS1B", "RUBASE"], value= "RUBASE", interactive=True, multiselect=False, label="Right model")
|
61 |
chatbot_right = gradio.Chatbot()
|
|
|
62 |
|
63 |
with gradio.Row():
|
64 |
gradio.Button('Both Good')
|
|
|
69 |
msg = gradio.Textbox()
|
70 |
clear = gradio.ClearButton([msg, chatbot_left, chatbot_right])
|
71 |
|
72 |
+
with gradio.Blocks():
|
73 |
+
model_left.change(clear_chat, [chatbot_left, msg], [chatbot_left, msg])
|
74 |
+
model_right.change(clear_chat, [chatbot_right, msg], [chatbot_right, msg])
|
75 |
+
msg.submit(model_gen, [msg, model_left, chatbot_left], [msg, chatbot_left])
|
76 |
+
msg.submit(model_gen, [msg, model_right, chatbot_right], [msg, chatbot_right])
|
77 |
|
78 |
# with gradio.Column():
|
79 |
# gradio.ChatInterface(
|