Spaces:
Runtime error
Runtime error
update descriptions
Browse files- app.py +7 -2
- descriptions.py +25 -0
app.py
CHANGED
|
@@ -21,6 +21,7 @@ from data.tokenizer import (
|
|
| 21 |
from data.collation import get_text_token_collater
|
| 22 |
from models.vallex import VALLE
|
| 23 |
from utils.g2p import PhonemeBpeTokenizer
|
|
|
|
| 24 |
|
| 25 |
import gradio as gr
|
| 26 |
import whisper
|
|
@@ -305,14 +306,16 @@ def infer_from_prompt(text, language, accent, prompt_file):
|
|
| 305 |
def main():
|
| 306 |
app = gr.Blocks()
|
| 307 |
with app:
|
|
|
|
| 308 |
with gr.Tab("Infer from audio"):
|
|
|
|
| 309 |
with gr.Row():
|
| 310 |
with gr.Column():
|
| 311 |
|
| 312 |
textbox = gr.TextArea(label="Text",
|
| 313 |
placeholder="Type your sentence here",
|
| 314 |
value="VALLEX can synthesize personalized speech in another language for a monolingual speaker.", elem_id=f"tts-input")
|
| 315 |
-
language_dropdown = gr.Dropdown(choices=['English', '中文', '日本語'
|
| 316 |
accent_dropdown = gr.Dropdown(choices=['no-accent', 'English', '中文', '日本語'], value='no-accent', label='accent')
|
| 317 |
upload_audio_prompt = gr.Audio(label='uploaded audio prompt', source='upload', interactive=True)
|
| 318 |
record_audio_prompt = gr.Audio(label='recorded audio prompt', source='microphone', interactive=True)
|
|
@@ -332,6 +335,7 @@ def main():
|
|
| 332 |
inputs=[textbox_mp, upload_audio_prompt, record_audio_prompt],
|
| 333 |
outputs=[text_output, prompt_output])
|
| 334 |
with gr.Tab("Make prompt"):
|
|
|
|
| 335 |
with gr.Row():
|
| 336 |
with gr.Column():
|
| 337 |
textbox2 = gr.TextArea(label="Prompt name",
|
|
@@ -347,12 +351,13 @@ def main():
|
|
| 347 |
inputs=[textbox2, upload_audio_prompt_2, record_audio_prompt_2],
|
| 348 |
outputs=[text_output_2, prompt_output_2])
|
| 349 |
with gr.Tab("Infer from prompt"):
|
|
|
|
| 350 |
with gr.Row():
|
| 351 |
with gr.Column():
|
| 352 |
textbox_3 = gr.TextArea(label="Text",
|
| 353 |
placeholder="Type your sentence here",
|
| 354 |
value="VALLEX can synthesize personalized speech in another language for a monolingual speaker.", elem_id=f"tts-input")
|
| 355 |
-
language_dropdown_3 = gr.Dropdown(choices=['English', '中文', '日本語'
|
| 356 |
label='language')
|
| 357 |
accent_dropdown_3 = gr.Dropdown(choices=['no-accent', 'English', '中文', '日本語'], value='no-accent',
|
| 358 |
label='accent')
|
|
|
|
| 21 |
from data.collation import get_text_token_collater
|
| 22 |
from models.vallex import VALLE
|
| 23 |
from utils.g2p import PhonemeBpeTokenizer
|
| 24 |
+
from descriptions import *
|
| 25 |
|
| 26 |
import gradio as gr
|
| 27 |
import whisper
|
|
|
|
| 306 |
def main():
|
| 307 |
app = gr.Blocks()
|
| 308 |
with app:
|
| 309 |
+
gr.Markdown(top_md)
|
| 310 |
with gr.Tab("Infer from audio"):
|
| 311 |
+
gr.Markdown(infer_from_audio_md)
|
| 312 |
with gr.Row():
|
| 313 |
with gr.Column():
|
| 314 |
|
| 315 |
textbox = gr.TextArea(label="Text",
|
| 316 |
placeholder="Type your sentence here",
|
| 317 |
value="VALLEX can synthesize personalized speech in another language for a monolingual speaker.", elem_id=f"tts-input")
|
| 318 |
+
language_dropdown = gr.Dropdown(choices=['English', '中文', '日本語'], value='English', label='language')
|
| 319 |
accent_dropdown = gr.Dropdown(choices=['no-accent', 'English', '中文', '日本語'], value='no-accent', label='accent')
|
| 320 |
upload_audio_prompt = gr.Audio(label='uploaded audio prompt', source='upload', interactive=True)
|
| 321 |
record_audio_prompt = gr.Audio(label='recorded audio prompt', source='microphone', interactive=True)
|
|
|
|
| 335 |
inputs=[textbox_mp, upload_audio_prompt, record_audio_prompt],
|
| 336 |
outputs=[text_output, prompt_output])
|
| 337 |
with gr.Tab("Make prompt"):
|
| 338 |
+
gr.Markdown(make_prompt_md)
|
| 339 |
with gr.Row():
|
| 340 |
with gr.Column():
|
| 341 |
textbox2 = gr.TextArea(label="Prompt name",
|
|
|
|
| 351 |
inputs=[textbox2, upload_audio_prompt_2, record_audio_prompt_2],
|
| 352 |
outputs=[text_output_2, prompt_output_2])
|
| 353 |
with gr.Tab("Infer from prompt"):
|
| 354 |
+
gr.Markdown(infer_from_prompt_md)
|
| 355 |
with gr.Row():
|
| 356 |
with gr.Column():
|
| 357 |
textbox_3 = gr.TextArea(label="Text",
|
| 358 |
placeholder="Type your sentence here",
|
| 359 |
value="VALLEX can synthesize personalized speech in another language for a monolingual speaker.", elem_id=f"tts-input")
|
| 360 |
+
language_dropdown_3 = gr.Dropdown(choices=['English', '中文', '日本語'], value='English',
|
| 361 |
label='language')
|
| 362 |
accent_dropdown_3 = gr.Dropdown(choices=['no-accent', 'English', '中文', '日本語'], value='no-accent',
|
| 363 |
label='accent')
|
descriptions.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
top_md = """
|
| 2 |
+
# VALL-E X
|
| 3 |
+
Unofficial implementation of Microsoft's [VALL-E X](https://arxiv.org/pdf/2303.03926).<br>
|
| 4 |
+
VALL-E X can synthesize high-quality personalized speech with only a 3-second enrolled recording of
|
| 5 |
+
an unseen speaker as an acoustic prompt, even in another language for a monolingual speaker.<br>
|
| 6 |
+
This implementation supports zero-shot, mono-lingual/cross-lingual text-to-speech functionality of three languages (English, Chinese, Japanese)<br>
|
| 7 |
+
See this [demo](https://plachtaa.github.io/) page for more details.
|
| 8 |
+
"""
|
| 9 |
+
|
| 10 |
+
infer_from_audio_md = """
|
| 11 |
+
Upload a speech of 3~10 seconds as the audio prompt and type in the text you'd like to synthesize.<br>
|
| 12 |
+
The model will synthesize speech of given text with the same voice of your audio prompt.<br>
|
| 13 |
+
The model also tends to preserve the emotion & acoustic environment of your given speech.<br>
|
| 14 |
+
For faster inference, please use **"Make prompt"** to get a `.npz` file as the encoded audio prompt, and use it by **"Infer from prompt"**
|
| 15 |
+
"""
|
| 16 |
+
|
| 17 |
+
make_prompt_md = """
|
| 18 |
+
Upload a speech of 3~10 seconds as the audio prompt.<br>
|
| 19 |
+
Get a `.npz` file as the encoded audio prompt. Use it by **"Infer with prompt"**
|
| 20 |
+
"""
|
| 21 |
+
|
| 22 |
+
infer_from_prompt_md = """
|
| 23 |
+
Faster than **"Infer from audio"**.<br>
|
| 24 |
+
You need to **"Make prompt"** first, and upload the encoded prompt (a `.npz` file)
|
| 25 |
+
"""
|