Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
|
@@ -375,14 +375,24 @@ def downvote_model(model, uname):
|
|
| 375 |
def a_is_better(model1, model2, userid):
|
| 376 |
userid = mkuuid(userid)
|
| 377 |
if model1 and model2:
|
| 378 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 379 |
upvote_model(model1, str(userid))
|
| 380 |
downvote_model(model2, str(userid))
|
| 381 |
return reload(model1, model2, userid, chose_a=True)
|
| 382 |
def b_is_better(model1, model2, userid):
|
| 383 |
userid = mkuuid(userid)
|
| 384 |
if model1 and model2:
|
| 385 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 386 |
upvote_model(model2, str(userid))
|
| 387 |
downvote_model(model1, str(userid))
|
| 388 |
return reload(model1, model2, userid, chose_b=True)
|
|
|
|
| 375 |
def a_is_better(model1, model2, userid):
|
| 376 |
userid = mkuuid(userid)
|
| 377 |
if model1 and model2:
|
| 378 |
+
conn = get_db()
|
| 379 |
+
cursor = conn.cursor()
|
| 380 |
+
cursor.execute('INSERT INTO votelog (username, chosen, rejected) VALUES (?, ?, ?)', (userid, model1, model2,))
|
| 381 |
+
with scheduler.lock:
|
| 382 |
+
conn.commit()
|
| 383 |
+
cursor.close()
|
| 384 |
upvote_model(model1, str(userid))
|
| 385 |
downvote_model(model2, str(userid))
|
| 386 |
return reload(model1, model2, userid, chose_a=True)
|
| 387 |
def b_is_better(model1, model2, userid):
|
| 388 |
userid = mkuuid(userid)
|
| 389 |
if model1 and model2:
|
| 390 |
+
conn = get_db()
|
| 391 |
+
cursor = conn.cursor()
|
| 392 |
+
cursor.execute('INSERT INTO votelog (username, chosen, rejected) VALUES (?, ?, ?)', (userid, model2, model1,))
|
| 393 |
+
with scheduler.lock:
|
| 394 |
+
conn.commit()
|
| 395 |
+
cursor.close()
|
| 396 |
upvote_model(model2, str(userid))
|
| 397 |
downvote_model(model1, str(userid))
|
| 398 |
return reload(model1, model2, userid, chose_b=True)
|