Spaces:
Sleeping
Sleeping
vtrv.vls
commited on
Commit
·
65408a7
1
Parent(s):
4bea324
Clear inputs on model change
Browse files
app.py
CHANGED
@@ -43,7 +43,6 @@ def model_gen(content, chat_history, model_type: str):
|
|
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)
|
48 |
|
49 |
def clear_chat():
|
@@ -53,7 +52,7 @@ def model_regen(content, chat_history, model_type: str):
|
|
53 |
if content is None:
|
54 |
return None, None
|
55 |
gen = MODEL_LIB[model_type]
|
56 |
-
print(
|
57 |
return gen(content, chat_history[:-1])
|
58 |
|
59 |
MODEL_LIB = {'RUBASE': giga_gen, 'TINYLLAMA': tiny_gen, 'QWEN2INS1B': qwen_gen}
|
@@ -67,6 +66,9 @@ def tab_arena():
|
|
67 |
model_right = gradio.Dropdown(["TINYLLAMA", "QWEN2INS1B", "RUBASE"], value= "RUBASE", interactive=True, multiselect=False, label="Right model")
|
68 |
chatbot_right = gradio.Chatbot()
|
69 |
|
|
|
|
|
|
|
70 |
with gradio.Row():
|
71 |
gradio.Button('Both Good')
|
72 |
gradio.Button('Left Better')
|
@@ -80,15 +82,12 @@ def tab_arena():
|
|
80 |
temp = gradio.Slider(label='Temperature', minimum=0, maximum=1, value=0.7, step=0.05, interactive=True)
|
81 |
max_tokens = gradio.Slider(label='Max ouput tokens', minimum=1, maximum=2048, value=512, step=1, interactive=True)
|
82 |
|
83 |
-
with gradio.Row():
|
84 |
-
msg = gradio.Textbox()
|
85 |
-
|
86 |
with gradio.Row():
|
87 |
clear = gradio.ClearButton([msg, chatbot_left, chatbot_right], value='Clear history')
|
88 |
regen_left = gradio.Button(value='Regenerate left answer')
|
89 |
regen_right = gradio.Button(value='Regenerate right answer')
|
90 |
regen_left.click(model_regen, [msg, chatbot_left, model_left], [msg, chatbot_left])
|
91 |
-
regen_right.click(model_regen, [msg, chatbot_right, model_right], [msg,
|
92 |
|
93 |
with gradio.Blocks():
|
94 |
model_left.change(clear_chat, [], [msg, chatbot_left])
|
|
|
43 |
if content is None:
|
44 |
return None, None
|
45 |
gen = MODEL_LIB[model_type]
|
|
|
46 |
return gen(content, chat_history)
|
47 |
|
48 |
def clear_chat():
|
|
|
52 |
if content is None:
|
53 |
return None, None
|
54 |
gen = MODEL_LIB[model_type]
|
55 |
+
print(chat_history[:-1])
|
56 |
return gen(content, chat_history[:-1])
|
57 |
|
58 |
MODEL_LIB = {'RUBASE': giga_gen, 'TINYLLAMA': tiny_gen, 'QWEN2INS1B': qwen_gen}
|
|
|
66 |
model_right = gradio.Dropdown(["TINYLLAMA", "QWEN2INS1B", "RUBASE"], value= "RUBASE", interactive=True, multiselect=False, label="Right model")
|
67 |
chatbot_right = gradio.Chatbot()
|
68 |
|
69 |
+
with gradio.Row():
|
70 |
+
msg = gradio.Textbox(label='Prompt', placeholder='Put your prompt here')
|
71 |
+
|
72 |
with gradio.Row():
|
73 |
gradio.Button('Both Good')
|
74 |
gradio.Button('Left Better')
|
|
|
82 |
temp = gradio.Slider(label='Temperature', minimum=0, maximum=1, value=0.7, step=0.05, interactive=True)
|
83 |
max_tokens = gradio.Slider(label='Max ouput tokens', minimum=1, maximum=2048, value=512, step=1, interactive=True)
|
84 |
|
|
|
|
|
|
|
85 |
with gradio.Row():
|
86 |
clear = gradio.ClearButton([msg, chatbot_left, chatbot_right], value='Clear history')
|
87 |
regen_left = gradio.Button(value='Regenerate left answer')
|
88 |
regen_right = gradio.Button(value='Regenerate right answer')
|
89 |
regen_left.click(model_regen, [msg, chatbot_left, model_left], [msg, chatbot_left])
|
90 |
+
regen_right.click(model_regen, [msg, chatbot_right, model_right], [msg, chatbot_right])
|
91 |
|
92 |
with gradio.Blocks():
|
93 |
model_left.change(clear_chat, [], [msg, chatbot_left])
|