vtrv.vls commited on
Commit
ce0391b
·
1 Parent(s): f25336d
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -39,8 +39,9 @@ def qwen_gen(content, chat_history):
39
  send_to_s3(res, f'protobench/tiny_{str(datetime.now()).replace(" ", "_")}.json', S3_SESSION)
40
  return '', chat_history
41
 
42
- def change_model(model, model_key):
43
- model = MODEL_LIB[model_key]
 
44
 
45
  MODEL_LIB = {'RUBASE': giga_gen, 'TINYLLAMA': tiny_gen, 'QWEN2INS1B': qwen_gen}
46
 
@@ -48,11 +49,9 @@ def tab_arena():
48
  with gradio.Row():
49
  with gradio.Column():
50
  model_left = gradio.Dropdown(["TINYLLAMA", "QWEN2INS1B", "RUBASE"], value="TINYLLAMA", interactive=True, multiselect=False, label="Left model")
51
- print(model_left)
52
  chatbot_left = gradio.Chatbot()
53
  with gradio.Column():
54
  model_right = gradio.Dropdown(["TINYLLAMA", "QWEN2INS1B", "RUBASE"], value= "RUBASE", interactive=True, multiselect=False, label="Right model")
55
- print(model_right)
56
  chatbot_right = gradio.Chatbot()
57
 
58
  with gradio.Row():
@@ -70,8 +69,8 @@ def tab_arena():
70
  # time.sleep(2)
71
  # return "", chat_history
72
 
73
- msg.submit(giga_gen, [msg, chatbot_left], [msg, chatbot_left])
74
- msg.submit(qwen_gen, [msg, chatbot_right], [msg, chatbot_right])
75
 
76
  # with gradio.Column():
77
  # gradio.ChatInterface(
 
39
  send_to_s3(res, f'protobench/tiny_{str(datetime.now()).replace(" ", "_")}.json', S3_SESSION)
40
  return '', chat_history
41
 
42
+ def model_gen(content, model_type: str, chat_history):
43
+ gen = MODEL_LIB[model_type]
44
+ return gen(content, chat_history)
45
 
46
  MODEL_LIB = {'RUBASE': giga_gen, 'TINYLLAMA': tiny_gen, 'QWEN2INS1B': qwen_gen}
47
 
 
49
  with gradio.Row():
50
  with gradio.Column():
51
  model_left = gradio.Dropdown(["TINYLLAMA", "QWEN2INS1B", "RUBASE"], value="TINYLLAMA", interactive=True, multiselect=False, label="Left model")
 
52
  chatbot_left = gradio.Chatbot()
53
  with gradio.Column():
54
  model_right = gradio.Dropdown(["TINYLLAMA", "QWEN2INS1B", "RUBASE"], value= "RUBASE", interactive=True, multiselect=False, label="Right model")
 
55
  chatbot_right = gradio.Chatbot()
56
 
57
  with gradio.Row():
 
69
  # time.sleep(2)
70
  # return "", chat_history
71
 
72
+ msg.submit(model_gen, [msg, model_left, chatbot_left], [msg, model_left, chatbot_left])
73
+ msg.submit(model_gen, [msg, model_left, chatbot_right], [msg, model_left, chatbot_right])
74
 
75
  # with gradio.Column():
76
  # gradio.ChatInterface(