Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
mrfakename
commited on
Commit
•
2bb5d82
1
Parent(s):
28550ba
Update app.py
Browse files
app.py
CHANGED
@@ -47,7 +47,7 @@ A list of the models, based on how highly they are ranked!
|
|
47 |
""".strip()
|
48 |
|
49 |
|
50 |
-
dataset = load_dataset("ttseval/tts-arena", token=os.getenv('HF_TOKEN'))
|
51 |
theme = gr.themes.Base(
|
52 |
font=[gr.themes.GoogleFont('Libre Franklin'), gr.themes.GoogleFont('Public Sans'), 'system-ui', 'sans-serif'],
|
53 |
)
|
@@ -70,12 +70,12 @@ model_names = {
|
|
70 |
'elevenlabs': 'ElevenLabs',
|
71 |
'speecht5': 'SpeechT5',
|
72 |
}
|
73 |
-
def get_random_split(existing_split=None):
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
def get_db():
|
80 |
return sqlite3.connect('database.db')
|
81 |
def create_db():
|
@@ -120,10 +120,10 @@ def get_data():
|
|
120 |
df = df[['name', 'score', 'votes']]
|
121 |
return df
|
122 |
|
123 |
-
def get_random_splits():
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
def upvote_model(model):
|
128 |
conn = get_db()
|
129 |
cursor = conn.cursor()
|
@@ -162,9 +162,10 @@ def both_good(model1, model2):
|
|
162 |
return reload(model1, model2)
|
163 |
def reload(chosenmodel1=None, chosenmodel2=None):
|
164 |
# Select random splits
|
165 |
-
|
166 |
-
|
167 |
-
|
|
|
168 |
if chosenmodel1 in model_names:
|
169 |
chosenmodel1 = model_names[chosenmodel1]
|
170 |
if chosenmodel2 in model_names:
|
@@ -214,19 +215,20 @@ with gr.Blocks() as vote:
|
|
214 |
|
215 |
|
216 |
with gr.Row():
|
217 |
-
abetter = gr.Button("A is Better", variant='primary')
|
218 |
-
bbetter = gr.Button("B is Better", variant='primary')
|
219 |
-
with gr.Row():
|
220 |
-
bothbad = gr.Button("Both are Bad", scale=2)
|
221 |
skipbtn = gr.Button("Skip", scale=1)
|
222 |
-
|
|
|
|
|
|
|
|
|
223 |
outputs = [aud1, aud2, model1, model2, prevmodel1, prevmodel2]
|
224 |
abetter.click(a_is_better, outputs=outputs, inputs=[model1, model2])
|
225 |
bbetter.click(b_is_better, outputs=outputs, inputs=[model1, model2])
|
226 |
skipbtn.click(b_is_better, outputs=outputs, inputs=[model1, model2])
|
227 |
|
228 |
-
bothbad.click(both_bad, outputs=outputs, inputs=[model1, model2])
|
229 |
-
bothgood.click(both_good, outputs=outputs, inputs=[model1, model2])
|
230 |
|
231 |
vote.load(reload, outputs=[aud1, aud2, model1, model2])
|
232 |
with gr.Blocks() as about:
|
|
|
47 |
""".strip()
|
48 |
|
49 |
|
50 |
+
dataset = load_dataset("ttseval/tts-arena-new", token=os.getenv('HF_TOKEN'))
|
51 |
theme = gr.themes.Base(
|
52 |
font=[gr.themes.GoogleFont('Libre Franklin'), gr.themes.GoogleFont('Public Sans'), 'system-ui', 'sans-serif'],
|
53 |
)
|
|
|
70 |
'elevenlabs': 'ElevenLabs',
|
71 |
'speecht5': 'SpeechT5',
|
72 |
}
|
73 |
+
# def get_random_split(existing_split=None):
|
74 |
+
# choice = random.choice(list(dataset.keys()))
|
75 |
+
# if existing_split and choice == existing_split:
|
76 |
+
# return get_random_split(choice)
|
77 |
+
# else:
|
78 |
+
# return choice
|
79 |
def get_db():
|
80 |
return sqlite3.connect('database.db')
|
81 |
def create_db():
|
|
|
120 |
df = df[['name', 'score', 'votes']]
|
121 |
return df
|
122 |
|
123 |
+
# def get_random_splits():
|
124 |
+
# choice1 = get_random_split()
|
125 |
+
# choice2 = get_random_split(choice1)
|
126 |
+
# return (choice1, choice2)
|
127 |
def upvote_model(model):
|
128 |
conn = get_db()
|
129 |
cursor = conn.cursor()
|
|
|
162 |
return reload(model1, model2)
|
163 |
def reload(chosenmodel1=None, chosenmodel2=None):
|
164 |
# Select random splits
|
165 |
+
row = random.choice(list(dataset['train']))
|
166 |
+
options = list(random.choice(list(dataset['train'])).keys())
|
167 |
+
split1, split2 = random.sample(options, 2)
|
168 |
+
choice1, choice2 = (row[split1], row[split2])
|
169 |
if chosenmodel1 in model_names:
|
170 |
chosenmodel1 = model_names[chosenmodel1]
|
171 |
if chosenmodel2 in model_names:
|
|
|
215 |
|
216 |
|
217 |
with gr.Row():
|
218 |
+
abetter = gr.Button("A is Better", variant='primary', scale=4)
|
|
|
|
|
|
|
219 |
skipbtn = gr.Button("Skip", scale=1)
|
220 |
+
bbetter = gr.Button("B is Better", variant='primary', scale=4)
|
221 |
+
# with gr.Row():
|
222 |
+
# bothbad = gr.Button("Both are Bad", scale=2)
|
223 |
+
# skipbtn = gr.Button("Skip", scale=1)
|
224 |
+
# bothgood = gr.Button("Both are Good", scale=2)
|
225 |
outputs = [aud1, aud2, model1, model2, prevmodel1, prevmodel2]
|
226 |
abetter.click(a_is_better, outputs=outputs, inputs=[model1, model2])
|
227 |
bbetter.click(b_is_better, outputs=outputs, inputs=[model1, model2])
|
228 |
skipbtn.click(b_is_better, outputs=outputs, inputs=[model1, model2])
|
229 |
|
230 |
+
# bothbad.click(both_bad, outputs=outputs, inputs=[model1, model2])
|
231 |
+
# bothgood.click(both_good, outputs=outputs, inputs=[model1, model2])
|
232 |
|
233 |
vote.load(reload, outputs=[aud1, aud2, model1, model2])
|
234 |
with gr.Blocks() as about:
|