Paul Alex commited on
Commit
9030486
1 Parent(s): cf1b1b7

add accuracy

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -24,7 +24,8 @@ def eval_agi(endpoint, temp, top_p, top_k, beams, max_tokens):
24
  test_df.loc[index, 'Answer_AGI_raw'] = ans
25
  print(index, '/', test_df.shape[0])
26
  time.sleep(0.001)
27
- return test_df[['ideal', 'Answer_AGI']]
 
28
 
29
  demo = gr.Interface(fn=eval_agi,
30
  inputs=[
@@ -35,6 +36,9 @@ demo = gr.Interface(fn=eval_agi,
35
  gr.inputs.Slider(0, 4, default=4, label='beams'),
36
  gr.inputs.Slider(0, 2000, default=128, label='max tokens')
37
  ],
38
- outputs='dataframe')
 
 
 
39
 
40
  demo.launch()
 
24
  test_df.loc[index, 'Answer_AGI_raw'] = ans
25
  print(index, '/', test_df.shape[0])
26
  time.sleep(0.001)
27
+ accuracy = (test_df['ideal'] == test_df['Answer_AGI']).sum() / len(test_df)
28
+ return [accuracy, test_df[['ideal', 'Answer_AGI']]]
29
 
30
  demo = gr.Interface(fn=eval_agi,
31
  inputs=[
 
36
  gr.inputs.Slider(0, 4, default=4, label='beams'),
37
  gr.inputs.Slider(0, 2000, default=128, label='max tokens')
38
  ],
39
+ outputs=[
40
+ gr.outputs.Label(label="Accuracy"),
41
+ 'dataframe'
42
+ ])
43
 
44
  demo.launch()