Spaces:
Running
Running
Commit
·
e54ab55
1
Parent(s):
c542faf
Update app.py
Browse files
app.py
CHANGED
@@ -25,8 +25,27 @@ def build_question_selector_map(questions):
|
|
25 |
|
26 |
return question_selector_map
|
27 |
|
28 |
-
def
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
return q["agent_response"]["llama"][0], q["agent_response"]["wizardlm"][0], q["agent_response"]["orca"][0], q["agent_response"]["llama"][1], q["agent_response"]["wizardlm"][1], q["agent_response"]["orca"][1], q["agent_response"]["llama"][2], q["agent_response"]["wizardlm"][2], q["agent_response"]["orca"][2]
|
32 |
|
@@ -110,8 +129,9 @@ math_result, math_cot_result, gsm_result, gsm_cot_result = load_responses()
|
|
110 |
math_questions, gsm_questions = load_questions(math_result, gsm_result)
|
111 |
|
112 |
math_question_selector_map = build_question_selector_map(math_result)
|
113 |
-
|
114 |
gsm_question_selector_map = build_question_selector_map(gsm_result)
|
|
|
115 |
|
116 |
TITLE = """<h1 align="center">LLM Agora 🗣️🏦</h1>"""
|
117 |
|
@@ -237,14 +257,14 @@ with gr.Blocks() as demo:
|
|
237 |
gr.HTML("""<h1 align="center"> The result of Math </h1>""")
|
238 |
# gr.Image(value="result/Math/math_result.png")
|
239 |
|
240 |
-
math_cot.
|
241 |
-
|
242 |
-
[
|
243 |
[math_model1_output1, math_model2_output1, math_model3_output1, math_model1_output2, math_model2_output2, math_model3_output2, math_model1_output3, math_model2_output3, math_model3_output3]
|
244 |
)
|
245 |
math_question_list.change(
|
246 |
-
|
247 |
-
[
|
248 |
[math_model1_output1, math_model2_output1, math_model3_output1, math_model1_output2, math_model2_output2, math_model3_output2, math_model1_output3, math_model2_output3, math_model3_output3]
|
249 |
)
|
250 |
|
|
|
25 |
|
26 |
return question_selector_map
|
27 |
|
28 |
+
def math_display_question_answer(question, cot, request: gr.Request):
|
29 |
+
if cot:
|
30 |
+
q = math_cot_question_selector_map[question]
|
31 |
+
else:
|
32 |
+
q = math_question_selector_map[question]
|
33 |
+
|
34 |
+
return q["agent_response"]["llama"][0], q["agent_response"]["wizardlm"][0], q["agent_response"]["orca"][0], q["agent_response"]["llama"][1], q["agent_response"]["wizardlm"][1], q["agent_response"]["orca"][1], q["agent_response"]["llama"][2], q["agent_response"]["wizardlm"][2], q["agent_response"]["orca"][2]
|
35 |
+
|
36 |
+
def gsm_display_question_answer(question, cot, request: gr.Request):
|
37 |
+
if cot:
|
38 |
+
q = gsm_cot_question_selector_map[question]
|
39 |
+
else:
|
40 |
+
q = gsm_question_selector_map[question]
|
41 |
+
|
42 |
+
return q["agent_response"]["llama"][0], q["agent_response"]["wizardlm"][0], q["agent_response"]["orca"][0], q["agent_response"]["llama"][1], q["agent_response"]["wizardlm"][1], q["agent_response"]["orca"][1], q["agent_response"]["llama"][2], q["agent_response"]["wizardlm"][2], q["agent_response"]["orca"][2]
|
43 |
+
|
44 |
+
def mmlu_display_question_answer(question, cot, request: gr.Request):
|
45 |
+
if cot:
|
46 |
+
q = mmlu_cot_question_selector_map[question]
|
47 |
+
else:
|
48 |
+
q = mmlu_question_selector_map[question]
|
49 |
|
50 |
return q["agent_response"]["llama"][0], q["agent_response"]["wizardlm"][0], q["agent_response"]["orca"][0], q["agent_response"]["llama"][1], q["agent_response"]["wizardlm"][1], q["agent_response"]["orca"][1], q["agent_response"]["llama"][2], q["agent_response"]["wizardlm"][2], q["agent_response"]["orca"][2]
|
51 |
|
|
|
129 |
math_questions, gsm_questions = load_questions(math_result, gsm_result)
|
130 |
|
131 |
math_question_selector_map = build_question_selector_map(math_result)
|
132 |
+
math_cot_question_selector_map = build_question_selector_map(math_cot_result)
|
133 |
gsm_question_selector_map = build_question_selector_map(gsm_result)
|
134 |
+
gsm_cot_question_selector_map = build_question_selector_map(gsm_cot_result)
|
135 |
|
136 |
TITLE = """<h1 align="center">LLM Agora 🗣️🏦</h1>"""
|
137 |
|
|
|
257 |
gr.HTML("""<h1 align="center"> The result of Math </h1>""")
|
258 |
# gr.Image(value="result/Math/math_result.png")
|
259 |
|
260 |
+
math_cot.select(
|
261 |
+
math_display_question_answer,
|
262 |
+
[math_question_list, math_cot],
|
263 |
[math_model1_output1, math_model2_output1, math_model3_output1, math_model1_output2, math_model2_output2, math_model3_output2, math_model1_output3, math_model2_output3, math_model3_output3]
|
264 |
)
|
265 |
math_question_list.change(
|
266 |
+
math_display_question_answer,
|
267 |
+
[math_question_list, math_cot],
|
268 |
[math_model1_output1, math_model2_output1, math_model3_output1, math_model1_output2, math_model2_output2, math_model3_output2, math_model1_output3, math_model2_output3, math_model3_output3]
|
269 |
)
|
270 |
|