Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
•
899d58f
1
Parent(s):
3679f5d
Update app.py
Browse files
app.py
CHANGED
@@ -9,7 +9,7 @@ import threading
|
|
9 |
import time
|
10 |
from huggingface_hub import HfApi
|
11 |
|
12 |
-
|
13 |
DESCR = """
|
14 |
# TTS Arena
|
15 |
|
@@ -207,21 +207,29 @@ def downvote_model(model, uname):
|
|
207 |
conn.commit()
|
208 |
cursor.close()
|
209 |
def a_is_better(model1, model2, profile: gr.OAuthProfile | None):
|
|
|
|
|
210 |
if model1 and model2:
|
211 |
upvote_model(model1, profile.username)
|
212 |
downvote_model(model2, profile.username)
|
213 |
return reload(model1, model2)
|
214 |
def b_is_better(model1, model2, profile: gr.OAuthProfile | None):
|
|
|
|
|
215 |
if model1 and model2:
|
216 |
upvote_model(model2, profile.username)
|
217 |
downvote_model(model1, profile.username)
|
218 |
return reload(model1, model2)
|
219 |
def both_bad(model1, model2, profile: gr.OAuthProfile | None):
|
|
|
|
|
220 |
if model1 and model2:
|
221 |
downvote_model(model1, profile.username)
|
222 |
downvote_model(model2, profile.username)
|
223 |
return reload(model1, model2)
|
224 |
def both_good(model1, model2, profile: gr.OAuthProfile | None):
|
|
|
|
|
225 |
if model1 and model2:
|
226 |
upvote_model(model1, profile.username)
|
227 |
upvote_model(model2, profile.username)
|
|
|
9 |
import time
|
10 |
from huggingface_hub import HfApi
|
11 |
|
12 |
+
MUST_BE_LOGGEDIN = "Please login with Hugging Face"
|
13 |
DESCR = """
|
14 |
# TTS Arena
|
15 |
|
|
|
207 |
conn.commit()
|
208 |
cursor.close()
|
209 |
def a_is_better(model1, model2, profile: gr.OAuthProfile | None):
|
210 |
+
if not profile:
|
211 |
+
raise gr.Error(MUST_BE_LOGGEDIN)
|
212 |
if model1 and model2:
|
213 |
upvote_model(model1, profile.username)
|
214 |
downvote_model(model2, profile.username)
|
215 |
return reload(model1, model2)
|
216 |
def b_is_better(model1, model2, profile: gr.OAuthProfile | None):
|
217 |
+
if not profile:
|
218 |
+
raise gr.Error(MUST_BE_LOGGEDIN)
|
219 |
if model1 and model2:
|
220 |
upvote_model(model2, profile.username)
|
221 |
downvote_model(model1, profile.username)
|
222 |
return reload(model1, model2)
|
223 |
def both_bad(model1, model2, profile: gr.OAuthProfile | None):
|
224 |
+
if not profile:
|
225 |
+
raise gr.Error(MUST_BE_LOGGEDIN)
|
226 |
if model1 and model2:
|
227 |
downvote_model(model1, profile.username)
|
228 |
downvote_model(model2, profile.username)
|
229 |
return reload(model1, model2)
|
230 |
def both_good(model1, model2, profile: gr.OAuthProfile | None):
|
231 |
+
if not profile:
|
232 |
+
raise gr.Error(MUST_BE_LOGGEDIN)
|
233 |
if model1 and model2:
|
234 |
upvote_model(model1, profile.username)
|
235 |
upvote_model(model2, profile.username)
|