Spaces:
Sleeping
Sleeping
vtrv.vls
commited on
Commit
·
a1b571e
1
Parent(s):
4d88e85
Functionality rework
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@ import os
|
|
4 |
import boto3
|
5 |
import pandas as pd
|
6 |
from copy import copy
|
|
|
7 |
|
8 |
import queue
|
9 |
|
@@ -17,6 +18,7 @@ TEST_MD = None
|
|
17 |
CURRENT_MODELS = queue.LifoQueue()
|
18 |
MODEL_LIB = {'TINYLLAMA': get_tinyllama, "QWEN2INS1B": get_qwen2ins1b, "RUBASE": GigaChat.get_giga}
|
19 |
GEN_LIB = {'TINYLLAMA': response_tinyllama, "QWEN2INS1B": response_qwen2ins1b, "RUBASE": response_gigachat}
|
|
|
20 |
|
21 |
def model_gen(
|
22 |
content,
|
@@ -35,7 +37,7 @@ def model_gen(
|
|
35 |
if len(content) == 0:
|
36 |
return '', []
|
37 |
|
38 |
-
chat_history = [
|
39 |
|
40 |
return model_response(
|
41 |
content,
|
@@ -88,13 +90,13 @@ def model_manager(
|
|
88 |
INIT_MODELS[add_model] = model_lib[add_model]()
|
89 |
|
90 |
def tab_online_arena():
|
91 |
-
global S3_SESSION, GEN_LIB, MODEL_LIB, INIT_MODELS, CURRENT_MODELS
|
92 |
with gradio.Row():
|
93 |
with gradio.Column():
|
94 |
-
model_left = gradio.Dropdown(
|
95 |
chatbot_left = gradio.Chatbot()
|
96 |
with gradio.Column():
|
97 |
-
model_right = gradio.Dropdown(
|
98 |
chatbot_right = gradio.Chatbot()
|
99 |
|
100 |
with gradio.Row():
|
@@ -197,13 +199,14 @@ def tab_leaderboard():
|
|
197 |
with gradio.Blocks() as demo:
|
198 |
gradio.DataFrame(df)
|
199 |
|
200 |
-
def tab_offline_arena():
|
|
|
201 |
# with gradio.Row():
|
202 |
# btn_show_history = gradio.Button("🎲 Click here to sample an example + a pair of LLM outputs! ", elem_classes="sample_button")
|
203 |
with gradio.Row():
|
204 |
with gradio.Column(scale=2):
|
205 |
with gradio.Accordion("Choose models to sample from", open=False, elem_classes="accordion-label"):
|
206 |
-
model_options =
|
207 |
selected_models = gradio.CheckboxGroup(model_options, info="", value=model_options, show_label=False, elem_id="select-models")
|
208 |
clear_button = gradio.Button("Clear", elem_classes="btn_boderline_gray", scale=1)
|
209 |
# clear the selected_models
|
|
|
4 |
import boto3
|
5 |
import pandas as pd
|
6 |
from copy import copy
|
7 |
+
from random import choice
|
8 |
|
9 |
import queue
|
10 |
|
|
|
18 |
CURRENT_MODELS = queue.LifoQueue()
|
19 |
MODEL_LIB = {'TINYLLAMA': get_tinyllama, "QWEN2INS1B": get_qwen2ins1b, "RUBASE": GigaChat.get_giga}
|
20 |
GEN_LIB = {'TINYLLAMA': response_tinyllama, "QWEN2INS1B": response_qwen2ins1b, "RUBASE": response_gigachat}
|
21 |
+
MODEL_LIST = ["TINYLLAMA", "QWEN2INS1B", "RUBASE"]
|
22 |
|
23 |
def model_gen(
|
24 |
content,
|
|
|
37 |
if len(content) == 0:
|
38 |
return '', []
|
39 |
|
40 |
+
chat_history = [] if no_context else chat_history
|
41 |
|
42 |
return model_response(
|
43 |
content,
|
|
|
90 |
INIT_MODELS[add_model] = model_lib[add_model]()
|
91 |
|
92 |
def tab_online_arena():
|
93 |
+
global S3_SESSION, GEN_LIB, MODEL_LIB, INIT_MODELS, CURRENT_MODELS, MODEL_LIST
|
94 |
with gradio.Row():
|
95 |
with gradio.Column():
|
96 |
+
model_left = gradio.Dropdown(MODEL_LIST, value=choice(MODEL_LIST), interactive=True, multiselect=False, label="Left model")
|
97 |
chatbot_left = gradio.Chatbot()
|
98 |
with gradio.Column():
|
99 |
+
model_right = gradio.Dropdown(MODEL_LIST, value=choice(MODEL_LIST), interactive=True, multiselect=False, label="Right model")
|
100 |
chatbot_right = gradio.Chatbot()
|
101 |
|
102 |
with gradio.Row():
|
|
|
199 |
with gradio.Blocks() as demo:
|
200 |
gradio.DataFrame(df)
|
201 |
|
202 |
+
def tab_offline_arena():
|
203 |
+
global MODEL_LIST
|
204 |
# with gradio.Row():
|
205 |
# btn_show_history = gradio.Button("🎲 Click here to sample an example + a pair of LLM outputs! ", elem_classes="sample_button")
|
206 |
with gradio.Row():
|
207 |
with gradio.Column(scale=2):
|
208 |
with gradio.Accordion("Choose models to sample from", open=False, elem_classes="accordion-label"):
|
209 |
+
model_options = MODEL_LIST
|
210 |
selected_models = gradio.CheckboxGroup(model_options, info="", value=model_options, show_label=False, elem_id="select-models")
|
211 |
clear_button = gradio.Button("Clear", elem_classes="btn_boderline_gray", scale=1)
|
212 |
# clear the selected_models
|