Spaces:
Running
on
Zero
Running
on
Zero
jedick
commited on
Commit
·
6444d2c
1
Parent(s):
9d59e2b
Save first predicted label for better display in HF Dataset Viewer
Browse files
app.py
CHANGED
|
@@ -332,6 +332,8 @@ with gr.Blocks(theme=my_theme, css=custom_css, head=font_awesome_html) as demo:
|
|
| 332 |
"""
|
| 333 |
Append input/outputs and user feedback to a JSON Lines file.
|
| 334 |
"""
|
|
|
|
|
|
|
| 335 |
with USER_FEEDBACK_PATH.open("a") as f:
|
| 336 |
f.write(
|
| 337 |
json.dumps(
|
|
@@ -339,7 +341,7 @@ with gr.Blocks(theme=my_theme, css=custom_css, head=font_awesome_html) as demo:
|
|
| 339 |
"claim": claim,
|
| 340 |
"evidence": evidence,
|
| 341 |
"model": model,
|
| 342 |
-
"prediction":
|
| 343 |
"user_label": user_label,
|
| 344 |
"datetime": datetime.now().isoformat(),
|
| 345 |
}
|
|
|
|
| 332 |
"""
|
| 333 |
Append input/outputs and user feedback to a JSON Lines file.
|
| 334 |
"""
|
| 335 |
+
# Get the first label (prediction with highest probability)
|
| 336 |
+
prediction = {k: v for k, v in [next(iter(label.items()))]}
|
| 337 |
with USER_FEEDBACK_PATH.open("a") as f:
|
| 338 |
f.write(
|
| 339 |
json.dumps(
|
|
|
|
| 341 |
"claim": claim,
|
| 342 |
"evidence": evidence,
|
| 343 |
"model": model,
|
| 344 |
+
"prediction": prediction,
|
| 345 |
"user_label": user_label,
|
| 346 |
"datetime": datetime.now().isoformat(),
|
| 347 |
}
|