Spaces:
Runtime error
Runtime error
Add application file
Browse files
app.py
CHANGED
|
@@ -74,7 +74,8 @@ def save_progress(annotation_data):
|
|
| 74 |
for adapter in annotation_data['scores']:
|
| 75 |
row.extend([adapter,
|
| 76 |
annotation_data['scores'][adapter]['grammar'],
|
| 77 |
-
annotation_data['scores'][adapter]['coherence']
|
|
|
|
| 78 |
])
|
| 79 |
writer.writerow(row)
|
| 80 |
|
|
@@ -100,10 +101,6 @@ def update_display(state):
|
|
| 100 |
if not comment_id:
|
| 101 |
return [gr.update(value="No examples!")] + [gr.update(visible=False)] * len(state["adapter_columns"]) * 4 + [gr.update(value="Complete!"), state]
|
| 102 |
|
| 103 |
-
# existing_annotation = {}
|
| 104 |
-
# if example["annotation_col"]:
|
| 105 |
-
# existing_annotation = json.loads(example["annotation_col"])
|
| 106 |
-
|
| 107 |
# Use annotation column from state
|
| 108 |
annotation_col = state["annotation_col"]
|
| 109 |
existing_annotation = {}
|
|
@@ -148,8 +145,8 @@ def submit(*args):
|
|
| 148 |
annotation_col = state["annotation_col"]
|
| 149 |
comment_id = state[state["current_view"] + "_ids"][state["current_id_index"]]
|
| 150 |
|
| 151 |
-
# Each adapter has
|
| 152 |
-
components_per_adapter =
|
| 153 |
adapter_scores = {}
|
| 154 |
|
| 155 |
|
|
|
|
| 74 |
for adapter in annotation_data['scores']:
|
| 75 |
row.extend([adapter,
|
| 76 |
annotation_data['scores'][adapter]['grammar'],
|
| 77 |
+
annotation_data['scores'][adapter]['coherence'],
|
| 78 |
+
annotation_data['scores'][adapter]['hallucination']
|
| 79 |
])
|
| 80 |
writer.writerow(row)
|
| 81 |
|
|
|
|
| 101 |
if not comment_id:
|
| 102 |
return [gr.update(value="No examples!")] + [gr.update(visible=False)] * len(state["adapter_columns"]) * 4 + [gr.update(value="Complete!"), state]
|
| 103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
# Use annotation column from state
|
| 105 |
annotation_col = state["annotation_col"]
|
| 106 |
existing_annotation = {}
|
|
|
|
| 145 |
annotation_col = state["annotation_col"]
|
| 146 |
comment_id = state[state["current_view"] + "_ids"][state["current_id_index"]]
|
| 147 |
|
| 148 |
+
# Each adapter has 9 components: text, grammar_title, grammar, coherence_title, coherence, separator, hallucination_title, hallucination, separator
|
| 149 |
+
components_per_adapter = 9
|
| 150 |
adapter_scores = {}
|
| 151 |
|
| 152 |
|