liujch1998 commited on
Commit
b57bf75
β€’
1 Parent(s): b206d70
Files changed (1) hide show
  1. app.py +8 -8
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('Logged statement to dataset:')
160
- print('Commit URL:', commit_url)
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('Logged feedback to dataset:')
179
- print('Commit URL:', commit_url)
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], \