Spaces:
Runtime error
Runtime error
Commit
Β·
b57bf75
1
Parent(s):
b206d70
Debug
Browse files
app.py
CHANGED
|
@@ -149,17 +149,17 @@ def predict(statements, do_saves):
|
|
| 149 |
'True': output_raw['score_calibrated'],
|
| 150 |
'False': 1 - output_raw['score_calibrated'],
|
| 151 |
} for output_raw in output_raws]
|
|
|
|
| 152 |
for output_raw, do_save in zip(output_raws, do_saves):
|
| 153 |
if do_save:
|
|
|
|
| 154 |
with open(DATA_PATH, 'a') as f:
|
| 155 |
json.dump(output_raw, f, ensure_ascii=False)
|
| 156 |
f.write('\n')
|
| 157 |
if any(do_saves):
|
| 158 |
commit_url = repo.push_to_hub()
|
| 159 |
-
print('
|
| 160 |
-
|
| 161 |
-
print(output_raw)
|
| 162 |
-
print()
|
| 163 |
return outputs, output_raws, \
|
| 164 |
[gr.update(visible=False) for _ in statements], \
|
| 165 |
[gr.update(visible=True) for _ in statements], \
|
|
@@ -167,18 +167,18 @@ def predict(statements, do_saves):
|
|
| 167 |
[gr.update(value='Please provide your feedback before trying out another statement.') for _ in statements]
|
| 168 |
|
| 169 |
def record_feedback(output_raws, feedback, do_saves):
|
|
|
|
| 170 |
for output_raw, do_save in zip(output_raws, do_saves):
|
| 171 |
if do_save:
|
|
|
|
| 172 |
output_raw.update({ 'feedback': feedback })
|
| 173 |
with open(DATA_PATH, 'a') as f:
|
| 174 |
json.dump(output_raw, f, ensure_ascii=False)
|
| 175 |
f.write('\n')
|
| 176 |
if any(do_saves):
|
| 177 |
commit_url = repo.push_to_hub()
|
| 178 |
-
print('
|
| 179 |
-
|
| 180 |
-
print(output_raw)
|
| 181 |
-
print()
|
| 182 |
return [gr.update(visible=True) for _ in output_raws], \
|
| 183 |
[gr.update(visible=False) for _ in output_raws], \
|
| 184 |
[gr.update(visible=False) for _ in output_raws], \
|
|
|
|
| 149 |
'True': output_raw['score_calibrated'],
|
| 150 |
'False': 1 - output_raw['score_calibrated'],
|
| 151 |
} for output_raw in output_raws]
|
| 152 |
+
print('Logging statements to dataset:')
|
| 153 |
for output_raw, do_save in zip(output_raws, do_saves):
|
| 154 |
if do_save:
|
| 155 |
+
print(output_raw)
|
| 156 |
with open(DATA_PATH, 'a') as f:
|
| 157 |
json.dump(output_raw, f, ensure_ascii=False)
|
| 158 |
f.write('\n')
|
| 159 |
if any(do_saves):
|
| 160 |
commit_url = repo.push_to_hub()
|
| 161 |
+
# print('Commit URL:', commit_url)
|
| 162 |
+
# print()
|
|
|
|
|
|
|
| 163 |
return outputs, output_raws, \
|
| 164 |
[gr.update(visible=False) for _ in statements], \
|
| 165 |
[gr.update(visible=True) for _ in statements], \
|
|
|
|
| 167 |
[gr.update(value='Please provide your feedback before trying out another statement.') for _ in statements]
|
| 168 |
|
| 169 |
def record_feedback(output_raws, feedback, do_saves):
|
| 170 |
+
print('Logged feedbacks to dataset:')
|
| 171 |
for output_raw, do_save in zip(output_raws, do_saves):
|
| 172 |
if do_save:
|
| 173 |
+
print(output_raw)
|
| 174 |
output_raw.update({ 'feedback': feedback })
|
| 175 |
with open(DATA_PATH, 'a') as f:
|
| 176 |
json.dump(output_raw, f, ensure_ascii=False)
|
| 177 |
f.write('\n')
|
| 178 |
if any(do_saves):
|
| 179 |
commit_url = repo.push_to_hub()
|
| 180 |
+
# print('Commit URL:', commit_url)
|
| 181 |
+
# print()
|
|
|
|
|
|
|
| 182 |
return [gr.update(visible=True) for _ in output_raws], \
|
| 183 |
[gr.update(visible=False) for _ in output_raws], \
|
| 184 |
[gr.update(visible=False) for _ in output_raws], \
|