gyigit commited on
Commit
a2267e1
·
2 Parent(s): dd49f8a 53feeb3

Merge branch 'main' of https://huggingface.co/spaces/mgyigit/probe3

Browse files
Files changed (1) hide show
  1. app.py +23 -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,14 @@ 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
  # Save human and skempi files under ./src/data/representation_vectors using pandas
 
 
 
 
31
  if human_file is not None:
32
  human_df = pd.read_csv(human_file)
33
  human_df.to_csv(f"./src/data/representation_vectors/{representation_name}_human.csv", index=False)
@@ -91,8 +111,8 @@ with block:
91
  )
92
 
93
  with gr.Column():
94
- human_file = gr.components.File(label="Click to Upload the representation file (csv) for Human dataset", file_count="single", type='binary')
95
- skempi_file = gr.components.File(label="Click to Upload the representation file (csv) for SKEMPI dataset", file_count="single", type='binary')
96
 
97
  submit_button = gr.Button("Submit Eval")
98
  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)
49
+ print(df.head().to_string())
50
+ return None
51
  if human_file is not None:
52
  human_df = pd.read_csv(human_file)
53
  human_df.to_csv(f"./src/data/representation_vectors/{representation_name}_human.csv", index=False)
 
111
  )
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()