StringChaos commited on
Commit
4cbc1c1
1 Parent(s): c0f02d6

add passed

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