WNJXYK commited on
Commit
fc6f0c5
·
verified ·
1 Parent(s): 22c93a7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -112,18 +112,16 @@ with demo:
112
  }[dataset]
113
  filename = f"{model}.json"
114
 
115
- yield f"Downloading sampled reasoning paths from Hugging Face {repo_id}...", gr.update(visible=False), gr.update(), gr.update()
116
  file_path = hf_hub_download(repo_id=repo_id, filename=filename, repo_type="dataset")
117
 
118
  global json_file
119
  with open(file_path, 'r', encoding='utf-8') as f:
120
  json_file = json.load(f)
121
  clist = get_available_problems()
122
- # yield "Removing downloaded file..."
123
- # print(file_path)
124
  os.remove(file_path)
125
-
126
- yield "Loading complete! You can now select a problem ID.", gr.update(visible=True), gr.update(value=f"Dataset: {dataset}\tModel: {model}\tK: {k_value}\tSeed: {seed}"), gr.update(choices=clist, value=clist[0])
127
 
128
  except Exception as e:
129
  yield f"Error: {str(e)}"
@@ -167,7 +165,7 @@ with demo:
167
 
168
  return gr.update(visible=True), gr.update(value=res_to_str(ppl_correct, ppl_answers)), gr.update(value=res_to_str(sc_correct, sc_answers)), gr.update(value=res_to_str(rpc_correct, rpc_answers))
169
 
170
- load_btn.click(fn=load, inputs=[dataset, model, k_value, seed],outputs=[load_btn, content_column, data_info, problem_id], show_progress="inside")
171
  run_btn.click(fn=evaluate, inputs=problem_id, outputs=[result_column, ppl_result, sc_result, rpc_result])
172
 
173
  if __name__ == "__main__":
 
112
  }[dataset]
113
  filename = f"{model}.json"
114
 
115
+ yield f"Downloading sampled reasoning paths from Hugging Face {repo_id}...", gr.update(visible=False), gr.update(), gr.update(), gr.update(visible=False)
116
  file_path = hf_hub_download(repo_id=repo_id, filename=filename, repo_type="dataset")
117
 
118
  global json_file
119
  with open(file_path, 'r', encoding='utf-8') as f:
120
  json_file = json.load(f)
121
  clist = get_available_problems()
 
 
122
  os.remove(file_path)
123
+
124
+ yield "Loading complete! You can now select a problem ID.", gr.update(visible=True), gr.update(value=f"Dataset: {dataset}\tModel: {model}\tK: {k_value}\tSeed: {seed}"), gr.update(choices=clist, value=clist[0]), gr.update(visible=False)
125
 
126
  except Exception as e:
127
  yield f"Error: {str(e)}"
 
165
 
166
  return gr.update(visible=True), gr.update(value=res_to_str(ppl_correct, ppl_answers)), gr.update(value=res_to_str(sc_correct, sc_answers)), gr.update(value=res_to_str(rpc_correct, rpc_answers))
167
 
168
+ load_btn.click(fn=load, inputs=[dataset, model, k_value, seed],outputs=[load_btn, content_column, data_info, problem_id, result_column], show_progress="inside")
169
  run_btn.click(fn=evaluate, inputs=problem_id, outputs=[result_column, ppl_result, sc_result, rpc_result])
170
 
171
  if __name__ == "__main__":