mgyigit commited on
Commit
53feeb3
·
verified ·
1 Parent(s): 87ccbbc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -3
app.py CHANGED
@@ -18,6 +18,20 @@ def get_baseline_df():
18
  df = df[present_columns]
19
  return df
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  def add_new_eval(
22
  human_file,
23
  skempi_file,
@@ -26,8 +40,9 @@ def add_new_eval(
26
  benchmark_type: str,
27
  ):
28
  representation_name = model_name_textbox if revision_name_textbox == '' else revision_name_textbox
29
- print(representation_name)
30
- print(benchmark_type)
 
31
  # Save human and skempi files under ./src/data/representation_vectors using pandas
32
  print(human_file)
33
  df = pd.read_csv(human_file)
@@ -97,7 +112,7 @@ with block:
97
 
98
  with gr.Column():
99
  human_file = gr.components.File(label="Click to Upload the representation file (csv) for Human dataset", file_count="single", type='filepath')
100
- skempi_file = gr.components.File(label="Click to Upload the representation file (csv) for SKEMPI dataset", file_count="single", type='binary')
101
 
102
  submit_button = gr.Button("Submit Eval")
103
  submission_result = gr.Markdown()
 
18
  df = df[present_columns]
19
  return df
20
 
21
+ def update_yaml(representation_name, benchmark_type, human_file_path, skempi_file_path):
22
+ with open("./src/bin/probe_config.yaml", 'r') as file:
23
+ yaml_data = yaml.safe_load(file)
24
+
25
+ yaml_data['representation_name'] = representation_name
26
+ yaml_data['benchmark'] = benchmark_type
27
+ yaml_data['representation_file_human'] = human_file
28
+ yaml_data['representation_file_affinity'] = skempi_file
29
+
30
+ with open("./src/bin/probe_config.yaml", "w") as file:
31
+ yaml.dump(yaml_data, file)
32
+
33
+ return None
34
+
35
  def add_new_eval(
36
  human_file,
37
  skempi_file,
 
40
  benchmark_type: str,
41
  ):
42
  representation_name = model_name_textbox if revision_name_textbox == '' else revision_name_textbox
43
+
44
+ update_yaml(representation_name, benchmark_type, human_file, skempi_file)
45
+
46
  # Save human and skempi files under ./src/data/representation_vectors using pandas
47
  print(human_file)
48
  df = pd.read_csv(human_file)
 
112
 
113
  with gr.Column():
114
  human_file = gr.components.File(label="Click to Upload the representation file (csv) for Human dataset", file_count="single", type='filepath')
115
+ skempi_file = gr.components.File(label="Click to Upload the representation file (csv) for SKEMPI dataset", file_count="single", type='filepath')
116
 
117
  submit_button = gr.Button("Submit Eval")
118
  submission_result = gr.Markdown()