mrfakename commited on
Commit
c055e89
1 Parent(s): 4cb3b9d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -12
app.py CHANGED
@@ -1,3 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
  DESCR = """
2
  # TTS Arena
3
 
@@ -14,21 +26,26 @@ INSTR = """
14
 
15
  **When you're ready to begin, click the Start button below!** The model names will be revealed once you vote.
16
  """.strip()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  LDESC = """
18
  ## Leaderboard
19
 
20
  A list of the models, based on how highly they are ranked!
21
  """.strip()
22
- import gradio as gr
23
- import random
24
- import os
25
- import shutil
26
- import pandas as pd
27
- import sqlite3
28
- from datasets import load_dataset
29
- import threading
30
- import time
31
- from huggingface_hub import HfApi
32
 
33
  dataset = load_dataset("ttseval/tts-arena", token=os.getenv('HF_TOKEN'))
34
  theme = gr.themes.Base(
@@ -164,7 +181,7 @@ def reload(chosenmodel1=None, chosenmodel2=None):
164
  with gr.Blocks() as leaderboard:
165
  gr.Markdown(LDESC)
166
  # df = gr.Dataframe(interactive=False, value=get_data())
167
- df = gr.Dataframe(interactive=False)
168
  leaderboard.load(get_data, outputs=[df])
169
  with gr.Blocks() as vote:
170
  gr.Markdown(INSTR)
@@ -208,9 +225,12 @@ with gr.Blocks() as vote:
208
  bothgood.click(both_good, outputs=outputs, inputs=[model1, model2])
209
 
210
  vote.load(reload, outputs=[aud1, aud2, model1, model2])
 
 
 
211
  with gr.Blocks(theme=theme, css="footer {visibility: hidden}", title="TTS Leaderboard") as demo:
212
  gr.Markdown(DESCR)
213
- gr.TabbedInterface([vote, leaderboard], ['Vote', 'Leaderboard'])
214
  def restart_space():
215
  api = HfApi(
216
  token=os.getenv('HF_TOKEN')
 
1
+ import gradio as gr
2
+ import random
3
+ import os
4
+ import shutil
5
+ import pandas as pd
6
+ import sqlite3
7
+ from datasets import load_dataset
8
+ import threading
9
+ import time
10
+ from huggingface_hub import HfApi
11
+
12
+
13
  DESCR = """
14
  # TTS Arena
15
 
 
26
 
27
  **When you're ready to begin, click the Start button below!** The model names will be revealed once you vote.
28
  """.strip()
29
+ request = ''
30
+ if os.getenv('HF_ID'):
31
+ request = """
32
+ ### Request Model
33
+
34
+ Please fill out [this form](https://huggingface.co/spaces/{os.getenv('HF_ID')}/discussions/new?title=%5BModel+Request%5D+&description=%23%23%20Model%20Request%0A%0A%2A%2AModel%20website%2Fpaper%20%28if%20applicable%29%2A%2A%3A%0A%2A%2AModel%20available%20on%2A%2A%3A%20%28coqui%7CHF%20pipeline%7Ccustom%20code%29%0A%2A%2AWhy%20do%20you%20want%20this%20model%20added%3F%2A%2A%0A%2A%2AComments%3A%2A%2A) to request a model.
35
+ """
36
+ ABOUT = f"""
37
+ ## About
38
+
39
+ TTS Arena is a project created to evaluate leading speech synthesis models. It is inspired by the [Chatbot Arena](https://chat.lmsys.org/) by LMSys.
40
+
41
+ {request}
42
+ """.strip()
43
  LDESC = """
44
  ## Leaderboard
45
 
46
  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(
 
181
  with gr.Blocks() as leaderboard:
182
  gr.Markdown(LDESC)
183
  # df = gr.Dataframe(interactive=False, value=get_data())
184
+ df = gr.Dataframe(interactive=False, min_width=0, wrap=True, column_widths=[200, 50, 50])
185
  leaderboard.load(get_data, outputs=[df])
186
  with gr.Blocks() as vote:
187
  gr.Markdown(INSTR)
 
225
  bothgood.click(both_good, outputs=outputs, inputs=[model1, model2])
226
 
227
  vote.load(reload, outputs=[aud1, aud2, model1, model2])
228
+ with gr.Blocks() as about:
229
+ gr.Markdown(ABOUT)
230
+ pass
231
  with gr.Blocks(theme=theme, css="footer {visibility: hidden}", title="TTS Leaderboard") as demo:
232
  gr.Markdown(DESCR)
233
+ gr.TabbedInterface([vote, leaderboard, about], ['Vote', 'Leaderboard', 'About'])
234
  def restart_space():
235
  api = HfApi(
236
  token=os.getenv('HF_TOKEN')