Update app.py
Browse files
app.py
CHANGED
|
@@ -52,6 +52,20 @@ def reload_db():
|
|
| 52 |
global dataset
|
| 53 |
dataset = load_dataset("ttseval/tts-arena-new", token=os.getenv('HF_TOKEN'))
|
| 54 |
return 'Reload Dataset'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
theme = gr.themes.Base(
|
| 56 |
font=[gr.themes.GoogleFont('Libre Franklin'), gr.themes.GoogleFont('Public Sans'), 'system-ui', 'sans-serif'],
|
| 57 |
)
|
|
@@ -72,6 +86,9 @@ model_names = {
|
|
| 72 |
'xtts2': 'XTTSv2',
|
| 73 |
'xtts': 'XTTS',
|
| 74 |
'elevenlabs': 'ElevenLabs',
|
|
|
|
|
|
|
|
|
|
| 75 |
'speecht5': 'SpeechT5',
|
| 76 |
}
|
| 77 |
# def get_random_split(existing_split=None):
|
|
@@ -237,7 +254,11 @@ with gr.Blocks() as about:
|
|
| 237 |
gr.Markdown(ABOUT)
|
| 238 |
with gr.Blocks() as admin:
|
| 239 |
rdb = gr.Button("Reload Dataset")
|
|
|
|
| 240 |
rdb.click(reload_db, outputs=rdb)
|
|
|
|
|
|
|
|
|
|
| 241 |
with gr.Blocks(theme=theme, css="footer {visibility: hidden}", title="TTS Leaderboard") as demo:
|
| 242 |
gr.Markdown(DESCR)
|
| 243 |
gr.TabbedInterface([vote, leaderboard, about, admin], ['Vote', 'Leaderboard', 'About', 'Admin (ONLY IN BETA)'])
|
|
|
|
| 52 |
global dataset
|
| 53 |
dataset = load_dataset("ttseval/tts-arena-new", token=os.getenv('HF_TOKEN'))
|
| 54 |
return 'Reload Dataset'
|
| 55 |
+
def del_db(txt):
|
| 56 |
+
if not txt.lower() == 'delete db':
|
| 57 |
+
raise gr.Error('You did not enter "delete db"')
|
| 58 |
+
api = HfApi(
|
| 59 |
+
token=os.getenv('HF_TOKEN')
|
| 60 |
+
)
|
| 61 |
+
api.delete_file(
|
| 62 |
+
path_in_repo='database.db',
|
| 63 |
+
repo_id=os.getenv('DATASET_ID'),
|
| 64 |
+
repo_type='dataset'
|
| 65 |
+
)
|
| 66 |
+
shutil.delete_file('database.db')
|
| 67 |
+
create_db()
|
| 68 |
+
return 'Delete DB'
|
| 69 |
theme = gr.themes.Base(
|
| 70 |
font=[gr.themes.GoogleFont('Libre Franklin'), gr.themes.GoogleFont('Public Sans'), 'system-ui', 'sans-serif'],
|
| 71 |
)
|
|
|
|
| 86 |
'xtts2': 'XTTSv2',
|
| 87 |
'xtts': 'XTTS',
|
| 88 |
'elevenlabs': 'ElevenLabs',
|
| 89 |
+
'openai': 'OpenAI',
|
| 90 |
+
'hierspeech': 'HierSpeech++',
|
| 91 |
+
'pheme': 'PolyAI Pheme',
|
| 92 |
'speecht5': 'SpeechT5',
|
| 93 |
}
|
| 94 |
# def get_random_split(existing_split=None):
|
|
|
|
| 254 |
gr.Markdown(ABOUT)
|
| 255 |
with gr.Blocks() as admin:
|
| 256 |
rdb = gr.Button("Reload Dataset")
|
| 257 |
+
ddb = gr.Button("Delete DB")
|
| 258 |
rdb.click(reload_db, outputs=rdb)
|
| 259 |
+
with gr.Group():
|
| 260 |
+
dbtext = gr.Textbox(label="Type \"delete db\" to confirm", placeholder="delete db")
|
| 261 |
+
ddb.click(del_db, inputs=dbtext, outputs=ddb)
|
| 262 |
with gr.Blocks(theme=theme, css="footer {visibility: hidden}", title="TTS Leaderboard") as demo:
|
| 263 |
gr.Markdown(DESCR)
|
| 264 |
gr.TabbedInterface([vote, leaderboard, about, admin], ['Vote', 'Leaderboard', 'About', 'Admin (ONLY IN BETA)'])
|