Spaces:
Running
Running
always pick one of top five models
Browse files
app.py
CHANGED
@@ -360,6 +360,7 @@ cached_samples: List[Sample] = []
|
|
360 |
voting_users = {
|
361 |
# userid as the key and USER() as the value
|
362 |
}
|
|
|
363 |
|
364 |
def generate_matching_pairs(samples: List[Sample]) -> List[Tuple[Sample, Sample]]:
|
365 |
transcript_groups: Dict[str, List[Sample]] = {}
|
@@ -685,12 +686,12 @@ def model_license(name):
|
|
685 |
def get_leaderboard(reveal_prelim = False):
|
686 |
conn = get_db()
|
687 |
cursor = conn.cursor()
|
688 |
-
sql = 'SELECT name, upvote, downvote FROM model'
|
689 |
# if not reveal_prelim: sql += ' WHERE EXISTS (SELECT 1 FROM model WHERE (upvote + downvote) > 750)'
|
690 |
if not reveal_prelim: sql += ' WHERE (upvote + downvote) > 300'
|
691 |
cursor.execute(sql)
|
692 |
data = cursor.fetchall()
|
693 |
-
df = pd.DataFrame(data, columns=['name', 'upvote', 'downvote'])
|
694 |
# df['license'] = df['name'].map(model_license)
|
695 |
df['name'] = df['name'].replace(model_names)
|
696 |
for i in range(len(df)):
|
@@ -726,6 +727,12 @@ def get_leaderboard(reveal_prelim = False):
|
|
726 |
return '#'+ rank
|
727 |
|
728 |
df['order'] = [assign_medal(i, not reveal_prelim and len(df) > 2) for i in range(len(df))]
|
|
|
|
|
|
|
|
|
|
|
|
|
729 |
df = df[['order', 'name', 'score', 'votes']]
|
730 |
return df
|
731 |
|
@@ -940,17 +947,20 @@ def synthandreturn(text, request: gr.Request):
|
|
940 |
|
941 |
# forced model: your TTS model versus The World!!!
|
942 |
# mdl1 = 'Pendrokar/xVASynth'
|
943 |
-
|
944 |
-
#
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
|
|
|
|
|
|
954 |
print("[debug] Using", mdl1, mdl2)
|
955 |
def predict_and_update_result(text, model, result_storage, request:gr.Request):
|
956 |
|
|
|
360 |
voting_users = {
|
361 |
# userid as the key and USER() as the value
|
362 |
}
|
363 |
+
top_five = []
|
364 |
|
365 |
def generate_matching_pairs(samples: List[Sample]) -> List[Tuple[Sample, Sample]]:
|
366 |
transcript_groups: Dict[str, List[Sample]] = {}
|
|
|
686 |
def get_leaderboard(reveal_prelim = False):
|
687 |
conn = get_db()
|
688 |
cursor = conn.cursor()
|
689 |
+
sql = 'SELECT name, upvote, downvote, name AS orig_name FROM model'
|
690 |
# if not reveal_prelim: sql += ' WHERE EXISTS (SELECT 1 FROM model WHERE (upvote + downvote) > 750)'
|
691 |
if not reveal_prelim: sql += ' WHERE (upvote + downvote) > 300'
|
692 |
cursor.execute(sql)
|
693 |
data = cursor.fetchall()
|
694 |
+
df = pd.DataFrame(data, columns=['name', 'upvote', 'downvote', 'orig_name'])
|
695 |
# df['license'] = df['name'].map(model_license)
|
696 |
df['name'] = df['name'].replace(model_names)
|
697 |
for i in range(len(df)):
|
|
|
727 |
return '#'+ rank
|
728 |
|
729 |
df['order'] = [assign_medal(i, not reveal_prelim and len(df) > 2) for i in range(len(df))]
|
730 |
+
# fetch top_five
|
731 |
+
for orig_name in df['orig_name']:
|
732 |
+
if reveal_prelim and len(top_five) < 5:
|
733 |
+
top_five.append(orig_name)
|
734 |
+
|
735 |
+
print(top_five)
|
736 |
df = df[['order', 'name', 'score', 'votes']]
|
737 |
return df
|
738 |
|
|
|
947 |
|
948 |
# forced model: your TTS model versus The World!!!
|
949 |
# mdl1 = 'Pendrokar/xVASynth'
|
950 |
+
|
951 |
+
# scrutinize the top five by always picking one of them
|
952 |
+
if (len(top_five) >= 5):
|
953 |
+
mdl1 = random.sample(top_five, 1)[0]
|
954 |
+
vsModels = dict(AVAILABLE_MODELS)
|
955 |
+
del vsModels[mdl1]
|
956 |
+
# randomize position of the forced model
|
957 |
+
mdl2 = random.sample(list(vsModels.keys()), 1)
|
958 |
+
# forced random
|
959 |
+
mdl1, mdl2 = random.sample(list([mdl1, mdl2[0]]), 2)
|
960 |
+
else:
|
961 |
+
# actual random
|
962 |
+
mdl1, mdl2 = random.sample(list(AVAILABLE_MODELS.keys()), 2)
|
963 |
+
|
964 |
print("[debug] Using", mdl1, mdl2)
|
965 |
def predict_and_update_result(text, model, result_storage, request:gr.Request):
|
966 |
|