Spaces:
Runtime error
Runtime error
liujch1998
commited on
Commit
Β·
8224785
1
Parent(s):
6a4226d
Debug
Browse files
app.py
CHANGED
@@ -102,6 +102,7 @@ try:
|
|
102 |
shutil.rmtree(DATA_DIR)
|
103 |
except:
|
104 |
pass
|
|
|
105 |
repo = huggingface_hub.Repository(
|
106 |
local_dir=DATA_DIR,
|
107 |
clone_from=DATASET_REPO_URL,
|
@@ -152,6 +153,7 @@ def predict(statements, do_saves):
|
|
152 |
'False': 1 - output_raw['score_calibrated'],
|
153 |
} for output_raw in output_raws]
|
154 |
print('Logging statements to dataset:')
|
|
|
155 |
lock.acquire()
|
156 |
for output_raw, do_save in zip(output_raws, do_saves):
|
157 |
if do_save:
|
@@ -169,6 +171,7 @@ def predict(statements, do_saves):
|
|
169 |
|
170 |
def record_feedback(output_raws, feedback, do_saves):
|
171 |
print('Logging feedbacks to dataset:')
|
|
|
172 |
lock.acquire()
|
173 |
for output_raw, do_save in zip(output_raws, do_saves):
|
174 |
if do_save:
|
@@ -189,6 +192,7 @@ def record_feedback_disagree(output_raws, do_saves):
|
|
189 |
return record_feedback(output_raws, 'disagree', do_saves)
|
190 |
|
191 |
def push():
|
|
|
192 |
lock.acquire()
|
193 |
if repo.is_repo_clean():
|
194 |
print('No new data recorded, skipping git push ...')
|
|
|
102 |
shutil.rmtree(DATA_DIR)
|
103 |
except:
|
104 |
pass
|
105 |
+
global repo, lock
|
106 |
repo = huggingface_hub.Repository(
|
107 |
local_dir=DATA_DIR,
|
108 |
clone_from=DATASET_REPO_URL,
|
|
|
153 |
'False': 1 - output_raw['score_calibrated'],
|
154 |
} for output_raw in output_raws]
|
155 |
print('Logging statements to dataset:')
|
156 |
+
global lock
|
157 |
lock.acquire()
|
158 |
for output_raw, do_save in zip(output_raws, do_saves):
|
159 |
if do_save:
|
|
|
171 |
|
172 |
def record_feedback(output_raws, feedback, do_saves):
|
173 |
print('Logging feedbacks to dataset:')
|
174 |
+
global lock
|
175 |
lock.acquire()
|
176 |
for output_raw, do_save in zip(output_raws, do_saves):
|
177 |
if do_save:
|
|
|
192 |
return record_feedback(output_raws, 'disagree', do_saves)
|
193 |
|
194 |
def push():
|
195 |
+
global repo, lock
|
196 |
lock.acquire()
|
197 |
if repo.is_repo_clean():
|
198 |
print('No new data recorded, skipping git push ...')
|