Spaces:
Running
Running
top_five by votes
Browse files- app/synth.py +18 -1
app/synth.py
CHANGED
|
@@ -11,9 +11,26 @@ import random, os, threading, tempfile
|
|
| 11 |
from langdetect import detect
|
| 12 |
from .vote import log_text
|
| 13 |
|
| 14 |
-
|
|
|
|
| 15 |
hf_token=os.getenv('HF_TOKEN')
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
def random_m():
|
| 18 |
return random.sample(list(set(AVAILABLE_MODELS.keys())), 2)
|
| 19 |
|
|
|
|
| 11 |
from langdetect import detect
|
| 12 |
from .vote import log_text
|
| 13 |
|
| 14 |
+
# top five models in order to always have one of them picked and scrutinized
|
| 15 |
+
top_five = ['fishaudio/fish-speech-1'] # fish 1.5
|
| 16 |
hf_token=os.getenv('HF_TOKEN')
|
| 17 |
|
| 18 |
+
# prioritize low vote models
|
| 19 |
+
sql = 'SELECT name FROM model WHERE (upvote + downvote) < 750 ORDER BY (upvote + downvote) ASC'
|
| 20 |
+
conn = get_db()
|
| 21 |
+
cursor = conn.cursor()
|
| 22 |
+
cursor.execute(sql)
|
| 23 |
+
data = cursor.fetchall()
|
| 24 |
+
for model in data:
|
| 25 |
+
if (
|
| 26 |
+
len(top_five) >= 5
|
| 27 |
+
):
|
| 28 |
+
break
|
| 29 |
+
|
| 30 |
+
if model[0] in AVAILABLE_MODELS.keys():
|
| 31 |
+
top_five.append(model[0])
|
| 32 |
+
print(f"low vote top_five: {top_five}")
|
| 33 |
+
|
| 34 |
def random_m():
|
| 35 |
return random.sample(list(set(AVAILABLE_MODELS.keys())), 2)
|
| 36 |
|