File size: 1,451 Bytes
f2d5c0f 61f9bac f2d5c0f 61f9bac f2d5c0f 61f9bac f2d5c0f 61f9bac f2d5c0f 61f9bac f2d5c0f 61f9bac f2d5c0f 61f9bac f2d5c0f 24142d6 61f9bac f2d5c0f 61f9bac f2d5c0f 61f9bac f2d5c0f 24142d6 61f9bac 24142d6 f2d5c0f 61f9bac f2d5c0f 61f9bac |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
import json
import gradio as gr
with open("problems.json") as f:
problems = json.load(f)
problem_choices = [q["question_title"] for q in problems]
with open("all_outputs.json") as f:
all_outputs = json.load(f)
model_choices = list(all_outputs.keys())
def update_view(problem_index, model_name):
code = all_outputs[model_name][problem_index]["code_list"][0]
correct = all_outputs[model_name][problem_index]["pass1_list"][0]
code_viewer = gr.Code(
label=f"Code for Model {model_name} on {problems[problem_index]['question_title']} problem. Passed: {correct}",
language="python",
lines=10,
value=code,
interactive=False,
)
return code_viewer
with gr.Blocks() as demo:
## dropdown
problem_dropdown = gr.Dropdown(
label="Selected Problem",
choices=problem_choices,
value=problem_choices[0],
type="index",
)
model_dropdown = gr.Dropdown(
label="Selected Model",
choices=model_choices,
value="GPT-4-Turbo-1106",
type="value",
)
code_viewer = update_view(0, model_choices[0])
problem_dropdown.change(
update_view, inputs=[problem_dropdown, model_dropdown], outputs=[code_viewer]
)
model_dropdown.change(
update_view, inputs=[problem_dropdown, model_dropdown], outputs=[code_viewer]
)
## code viewer
if __name__ == "__main__":
demo.launch()
|