Spaces:
Runtime error
Runtime error
Commit
Β·
15a601f
1
Parent(s):
481afa0
Git push exceptions
Browse files
app.py
CHANGED
|
@@ -157,14 +157,18 @@ def predict(statements, do_saves):
|
|
| 157 |
json.dump(output_raw, f, ensure_ascii=False)
|
| 158 |
f.write('\n')
|
| 159 |
if any(do_saves):
|
| 160 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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], \
|
| 166 |
[gr.update(visible=True) for _ in statements], \
|
| 167 |
-
[gr.update(value='Please
|
| 168 |
|
| 169 |
def record_feedback(output_raws, feedback, do_saves):
|
| 170 |
print('Logging feedbacks to dataset:')
|
|
@@ -176,13 +180,17 @@ def record_feedback(output_raws, feedback, do_saves):
|
|
| 176 |
json.dump(output_raw, f, ensure_ascii=False)
|
| 177 |
f.write('\n')
|
| 178 |
if any(do_saves):
|
| 179 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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], \
|
| 185 |
-
[gr.update(value='Thanks for your feedback!
|
| 186 |
def record_feedback_agree(output_raws, do_saves):
|
| 187 |
return record_feedback(output_raws, 'agree', do_saves)
|
| 188 |
def record_feedback_disagree(output_raws, do_saves):
|
|
|
|
| 157 |
json.dump(output_raw, f, ensure_ascii=False)
|
| 158 |
f.write('\n')
|
| 159 |
if any(do_saves):
|
| 160 |
+
try:
|
| 161 |
+
commit_url = repo.push_to_hub()
|
| 162 |
+
except Exception as e:
|
| 163 |
+
print('Failed to push to GitHub:', e)
|
| 164 |
+
repo.git_pull(rebase=True)
|
| 165 |
# print('Commit URL:', commit_url)
|
| 166 |
# print()
|
| 167 |
return outputs, output_raws, \
|
| 168 |
[gr.update(visible=False) for _ in statements], \
|
| 169 |
[gr.update(visible=True) for _ in statements], \
|
| 170 |
[gr.update(visible=True) for _ in statements], \
|
| 171 |
+
[gr.update(value='Please share your feedback before trying out another statement.') for _ in statements]
|
| 172 |
|
| 173 |
def record_feedback(output_raws, feedback, do_saves):
|
| 174 |
print('Logging feedbacks to dataset:')
|
|
|
|
| 180 |
json.dump(output_raw, f, ensure_ascii=False)
|
| 181 |
f.write('\n')
|
| 182 |
if any(do_saves):
|
| 183 |
+
try:
|
| 184 |
+
commit_url = repo.push_to_hub()
|
| 185 |
+
except Exception as e:
|
| 186 |
+
print('Failed to push to GitHub:', e)
|
| 187 |
+
repo.git_pull(rebase=True)
|
| 188 |
# print('Commit URL:', commit_url)
|
| 189 |
# print()
|
| 190 |
return [gr.update(visible=True) for _ in output_raws], \
|
| 191 |
[gr.update(visible=False) for _ in output_raws], \
|
| 192 |
[gr.update(visible=False) for _ in output_raws], \
|
| 193 |
+
[gr.update(value='Thanks for sharing your feedback! You can now enter another statement.') for _ in output_raws]
|
| 194 |
def record_feedback_agree(output_raws, do_saves):
|
| 195 |
return record_feedback(output_raws, 'agree', do_saves)
|
| 196 |
def record_feedback_disagree(output_raws, do_saves):
|