BreakLee commited on
Commit
10b3494
1 Parent(s): b612e30

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -6
app.py CHANGED
@@ -33,7 +33,15 @@ def prediction_analyse(prediction_content):
33
 
34
  # 遍历 predictions,计算每个 question_type_id 的正确预测数和总预测数
35
  for prediction in predictions:
36
- prediction = json.loads(prediction)
 
 
 
 
 
 
 
 
37
  question_id = prediction["question_id"]
38
  gt_item = ground_truth[question_id]
39
  question_type_id = gt_item["question_type_id"]
@@ -77,10 +85,16 @@ def add_new_eval(
77
  LLM_name = LLM_name_textbox
78
  else:
79
  LLM_name = LLM_type
 
 
 
 
 
 
80
  # add new data
81
  new_data = [
82
  model_type,
83
- model_name_textbox,
84
  LLM_name,
85
  each_task_accuracy[1],
86
  each_task_accuracy[2],
@@ -148,7 +162,6 @@ with block:
148
  )
149
 
150
  def on_checkbox_group_change(selected_columns):
151
- print("TEst")
152
  # pdb.set_trace()
153
  selected_columns = [item for item in TASK_INFO if item in selected_columns]
154
  present_columns = MODEL_INFO + selected_columns
@@ -156,8 +169,6 @@ with block:
156
  updated_headers = present_columns
157
  update_datatype = [DATA_TITILE_TYPE[COLUMN_NAMES.index(x)] for x in updated_headers]
158
 
159
- # data_component.update(value=updated_data, headers=updated_headers, datatype=update_datatype)
160
-
161
  filter_component = gr.components.Dataframe(
162
  value=updated_data,
163
  headers=updated_headers,
@@ -202,7 +213,7 @@ with block:
202
  ],
203
  label="Model type",
204
  multiselect=False,
205
- value="LLaMA-7B",
206
  interactive=True,
207
  )
208
  model_link = gr.Textbox(
 
33
 
34
  # 遍历 predictions,计算每个 question_type_id 的正确预测数和总预测数
35
  for prediction in predictions:
36
+ # pdb.set_trace()
37
+ prediction = prediction.strip()
38
+ if not prediction:
39
+ continue
40
+ try:
41
+ prediction = json.loads(prediction)
42
+ except json.JSONDecodeError:
43
+ print(f"Warning: Skipping invalid JSON data in line: {prediction}")
44
+ continue
45
  question_id = prediction["question_id"]
46
  gt_item = ground_truth[question_id]
47
  question_type_id = gt_item["question_type_id"]
 
85
  LLM_name = LLM_name_textbox
86
  else:
87
  LLM_name = LLM_type
88
+
89
+ pdb.set_trace()
90
+ if model_link == '':
91
+ model_name = model_name_textbox # no url
92
+ else:
93
+ model_name = '[' + model_name_textbox + '](' + model_link + ')'
94
  # add new data
95
  new_data = [
96
  model_type,
97
+ model_name,
98
  LLM_name,
99
  each_task_accuracy[1],
100
  each_task_accuracy[2],
 
162
  )
163
 
164
  def on_checkbox_group_change(selected_columns):
 
165
  # pdb.set_trace()
166
  selected_columns = [item for item in TASK_INFO if item in selected_columns]
167
  present_columns = MODEL_INFO + selected_columns
 
169
  updated_headers = present_columns
170
  update_datatype = [DATA_TITILE_TYPE[COLUMN_NAMES.index(x)] for x in updated_headers]
171
 
 
 
172
  filter_component = gr.components.Dataframe(
173
  value=updated_data,
174
  headers=updated_headers,
 
213
  ],
214
  label="Model type",
215
  multiselect=False,
216
+ value=ModelType.FT.to_str(" : "),
217
  interactive=True,
218
  )
219
  model_link = gr.Textbox(