mrfakename commited on
Commit
0903ad6
1 Parent(s): 6a2a6e9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -403,6 +403,8 @@ def downvote_model(model, uname):
403
 
404
  def a_is_better(model1, model2, userid):
405
  print("A is better", model1, model2)
 
 
406
  userid = mkuuid(userid)
407
  if model1 and model2:
408
  conn = get_db()
@@ -416,6 +418,8 @@ def a_is_better(model1, model2, userid):
416
  return reload(model1, model2, userid, chose_a=True)
417
  def b_is_better(model1, model2, userid):
418
  print("B is better", model1, model2)
 
 
419
  userid = mkuuid(userid)
420
  if model1 and model2:
421
  conn = get_db()
 
403
 
404
  def a_is_better(model1, model2, userid):
405
  print("A is better", model1, model2)
406
+ if not model1 in AVAILABLE_MODELS.keys() and not model1 in AVAILABLE_MODELS.values():
407
+ raise gr.Error('Sorry, please try voting again.')
408
  userid = mkuuid(userid)
409
  if model1 and model2:
410
  conn = get_db()
 
418
  return reload(model1, model2, userid, chose_a=True)
419
  def b_is_better(model1, model2, userid):
420
  print("B is better", model1, model2)
421
+ if not model1 in AVAILABLE_MODELS.keys() and not model1 in AVAILABLE_MODELS.values():
422
+ raise gr.Error('Sorry, please try voting again.')
423
  userid = mkuuid(userid)
424
  if model1 and model2:
425
  conn = get_db()