mrfakename commited on
Commit
af37f5e
1 Parent(s): 433517c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -17
app.py CHANGED
@@ -269,7 +269,8 @@ model_links = {
269
  # return (choice1, choice2)
270
  def mkuuid(uid):
271
  if not uid:
272
- uid = str(uuid.uuid4())
 
273
  def upvote_model(model, uname):
274
  conn = get_db()
275
  cursor = conn.cursor()
@@ -293,29 +294,29 @@ def downvote_model(model, uname):
293
  cursor.close()
294
 
295
  def a_is_better(model1, model2, userid):
296
- mkuuid(userid)
297
  if model1 and model2:
298
- upvote_model(model1, userid)
299
- downvote_model(model2, userid)
300
- return reload(model1, model2)
301
  def b_is_better(model1, model2, userid):
302
- mkuuid(userid)
303
  if model1 and model2:
304
- upvote_model(model2, userid)
305
- downvote_model(model1, userid)
306
- return reload(model1, model2)
307
  def both_bad(model1, model2, userid):
308
- mkuuid(userid)
309
  if model1 and model2:
310
- downvote_model(model1, userid)
311
- downvote_model(model2, userid)
312
- return reload(model1, model2)
313
  def both_good(model1, model2, userid):
314
- mkuuid(userid)
315
  if model1 and model2:
316
- upvote_model(model1, userid)
317
- upvote_model(model2, userid)
318
- return reload(model1, model2)
319
  def reload(chosenmodel1=None, chosenmodel2=None):
320
  # Select random splits
321
  row = random.choice(list(audio_dataset['train']))
 
269
  # return (choice1, choice2)
270
  def mkuuid(uid):
271
  if not uid:
272
+ uid = uuid.uuid4()
273
+ return uid
274
  def upvote_model(model, uname):
275
  conn = get_db()
276
  cursor = conn.cursor()
 
294
  cursor.close()
295
 
296
  def a_is_better(model1, model2, userid):
297
+ userid = mkuuid(userid)
298
  if model1 and model2:
299
+ upvote_model(model1, str(userid))
300
+ downvote_model(model2, str(userid))
301
+ return reload(model1, model2), userid
302
  def b_is_better(model1, model2, userid):
303
+ userid = mkuuid(userid)
304
  if model1 and model2:
305
+ upvote_model(model2, str(userid))
306
+ downvote_model(model1, str(userid))
307
+ return reload(model1, model2), userid
308
  def both_bad(model1, model2, userid):
309
+ userid = mkuuid(userid)
310
  if model1 and model2:
311
+ downvote_model(model1, str(userid))
312
+ downvote_model(model2, str(userid))
313
+ return reload(model1, model2), userid
314
  def both_good(model1, model2, userid):
315
+ userid = mkuuid(userid)
316
  if model1 and model2:
317
+ upvote_model(model1, str(userid))
318
+ upvote_model(model2, str(userid))
319
+ return reload(model1, model2), userid
320
  def reload(chosenmodel1=None, chosenmodel2=None):
321
  # Select random splits
322
  row = random.choice(list(audio_dataset['train']))