liujch1998 commited on
Commit
295d753
Β·
1 Parent(s): b7fb5d6
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -154,7 +154,7 @@ def predict(statements, do_saves):
154
  'True': output_raw['score_calibrated'],
155
  'False': 1 - output_raw['score_calibrated'],
156
  } for output_raw in output_raws]
157
- print('Logging statements to dataset:')
158
  lock.acquire()
159
  for output_raw, do_save in zip(output_raws, do_saves):
160
  if do_save:
@@ -174,7 +174,7 @@ def predict(statements, do_saves):
174
 
175
  def record_feedback(output_raws, feedback, do_saves):
176
  global lock
177
- print('Logging feedbacks to dataset:')
178
  lock.acquire()
179
  for output_raw, do_save in zip(output_raws, do_saves):
180
  if do_save:
@@ -204,8 +204,9 @@ def push():
204
  global repo, lock
205
  lock.acquire()
206
  if repo.is_repo_clean():
207
- print('No new data recorded, skipping git push ...')
208
- print()
 
209
  else:
210
  try:
211
  commit_url = repo.push_to_hub()
@@ -308,7 +309,7 @@ with gr.Blocks() as demo:
308
 
309
  Type a commonsense statement in the box below and click the submit button to see Vera's prediction on its correctness. You can try both correct and incorrect statements. If you are looking for inspiration, try the examples at the bottom of the page!
310
 
311
- We'd love your feedback! Please indicate whether you agree or disagree with Vera's prediction (and don't mind the percentage numbers).
312
 
313
  ⚠️ **Intended Use**: Vera is a research prototype and may make mistakes. Do not use for making critical decisions. It is intended to predict the correctness of commonsense statements, and may be unreliable when taking input out of this scope.
314
 
@@ -316,14 +317,14 @@ with gr.Blocks() as demo:
316
  '''
317
  )
318
  with gr.Row():
319
- with gr.Column(scale=1):
320
  do_save = gr.Checkbox(
321
  value=True,
322
  label="Store data",
323
  info="You agree to the storage of your input for research and development purposes:")
324
  statement = gr.Textbox(placeholder='Enter a commonsense statement here, or select an example from below', label='Statement', interactive=True)
325
  submit = gr.Button(value='Submit', variant='primary', visible=True)
326
- with gr.Column(scale=1):
327
  output = gr.Label(num_top_classes=2, interactive=False)
328
  output_raw = gr.JSON(visible=False)
329
  with gr.Row():
 
154
  'True': output_raw['score_calibrated'],
155
  'False': 1 - output_raw['score_calibrated'],
156
  } for output_raw in output_raws]
157
+ print(f'Logging statements to {DATA_FILENAME}:')
158
  lock.acquire()
159
  for output_raw, do_save in zip(output_raws, do_saves):
160
  if do_save:
 
174
 
175
  def record_feedback(output_raws, feedback, do_saves):
176
  global lock
177
+ print(f'Logging feedbacks to {DATA_FILENAME}:')
178
  lock.acquire()
179
  for output_raw, do_save in zip(output_raws, do_saves):
180
  if do_save:
 
204
  global repo, lock
205
  lock.acquire()
206
  if repo.is_repo_clean():
207
+ # print('No new data recorded, skipping git push ...')
208
+ # print()
209
+ pass
210
  else:
211
  try:
212
  commit_url = repo.push_to_hub()
 
309
 
310
  Type a commonsense statement in the box below and click the submit button to see Vera's prediction on its correctness. You can try both correct and incorrect statements. If you are looking for inspiration, try the examples at the bottom of the page!
311
 
312
+ We'd love your feedback! Please indicate whether you agree or disagree with Vera's prediction (and don't mind the percentage numbers). If you're unsure or the statement doesn't have a certain correctness label, please select "Uncertain".
313
 
314
  ⚠️ **Intended Use**: Vera is a research prototype and may make mistakes. Do not use for making critical decisions. It is intended to predict the correctness of commonsense statements, and may be unreliable when taking input out of this scope.
315
 
 
317
  '''
318
  )
319
  with gr.Row():
320
+ with gr.Column(scale=3):
321
  do_save = gr.Checkbox(
322
  value=True,
323
  label="Store data",
324
  info="You agree to the storage of your input for research and development purposes:")
325
  statement = gr.Textbox(placeholder='Enter a commonsense statement here, or select an example from below', label='Statement', interactive=True)
326
  submit = gr.Button(value='Submit', variant='primary', visible=True)
327
+ with gr.Column(scale=2):
328
  output = gr.Label(num_top_classes=2, interactive=False)
329
  output_raw = gr.JSON(visible=False)
330
  with gr.Row():