Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
import spaces
|
| 2 |
import os
|
| 3 |
from huggingface_hub import login
|
| 4 |
import gradio as gr
|
|
@@ -40,11 +39,10 @@ vocoder = load_vocoder()
|
|
| 40 |
model = load_model(
|
| 41 |
DiT,
|
| 42 |
dict(dim=1024, depth=22, heads=16, ff_mult=2, text_dim=512, conv_layers=4),
|
| 43 |
-
ckpt_path=str(cached_path("hf://
|
| 44 |
-
vocab_file=str(cached_path("hf://
|
| 45 |
)
|
| 46 |
|
| 47 |
-
@spaces.GPU
|
| 48 |
def infer_tts(ref_audio_orig: str, gen_text: str, speed: float = 1.0, request: gr.Request = None):
|
| 49 |
|
| 50 |
if not ref_audio_orig:
|
|
@@ -68,11 +66,12 @@ def infer_tts(ref_audio_orig: str, gen_text: str, speed: float = 1.0, request: g
|
|
| 68 |
raise gr.Error(f"Error generating voice: {e}")
|
| 69 |
|
| 70 |
# Gradio UI
|
| 71 |
-
with gr.Blocks(
|
| 72 |
gr.Markdown("""
|
| 73 |
# 🎤 F5-TTS: Vietnamese Text-to-Speech Synthesis.
|
| 74 |
-
# The model was trained for
|
| 75 |
Enter text and upload a sample voice to generate natural speech.
|
|
|
|
| 76 |
""")
|
| 77 |
|
| 78 |
with gr.Row():
|
|
@@ -90,7 +89,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 90 |
value="""1. This model may not perform well with numerical characters, dates, special characters, etc. => A text normalization module is needed.
|
| 91 |
2. The rhythm of some generated audios may be inconsistent or choppy => It is recommended to select clearly pronounced sample audios with minimal pauses for better synthesis quality.
|
| 92 |
3. Default, reference audio text uses the whisper-large-v3-turbo model, which may not always accurately recognize Vietnamese, resulting in poor voice synthesis quality.
|
| 93 |
-
4. Checkpoint is stopped at step
|
| 94 |
5. Inference with overly long paragraphs may produce poor results.""",
|
| 95 |
label="❗ Model Limitations",
|
| 96 |
lines=5,
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
from huggingface_hub import login
|
| 3 |
import gradio as gr
|
|
|
|
| 39 |
model = load_model(
|
| 40 |
DiT,
|
| 41 |
dict(dim=1024, depth=22, heads=16, ff_mult=2, text_dim=512, conv_layers=4),
|
| 42 |
+
ckpt_path=str(cached_path("hf://nam194/F5-TTS-Vietnamese/model_350000.safetensors")),
|
| 43 |
+
vocab_file=str(cached_path("hf://nam194/F5-TTS-Vietnamese/vocab.txt")),
|
| 44 |
)
|
| 45 |
|
|
|
|
| 46 |
def infer_tts(ref_audio_orig: str, gen_text: str, speed: float = 1.0, request: gr.Request = None):
|
| 47 |
|
| 48 |
if not ref_audio_orig:
|
|
|
|
| 66 |
raise gr.Error(f"Error generating voice: {e}")
|
| 67 |
|
| 68 |
# Gradio UI
|
| 69 |
+
with gr.Blocks() as demo:
|
| 70 |
gr.Markdown("""
|
| 71 |
# 🎤 F5-TTS: Vietnamese Text-to-Speech Synthesis.
|
| 72 |
+
# The model was trained for 350.000 steps with approximately 1000 hours of data on an RTX 3090 GPU.
|
| 73 |
Enter text and upload a sample voice to generate natural speech.
|
| 74 |
+
CPU inference time may take minutes.
|
| 75 |
""")
|
| 76 |
|
| 77 |
with gr.Row():
|
|
|
|
| 89 |
value="""1. This model may not perform well with numerical characters, dates, special characters, etc. => A text normalization module is needed.
|
| 90 |
2. The rhythm of some generated audios may be inconsistent or choppy => It is recommended to select clearly pronounced sample audios with minimal pauses for better synthesis quality.
|
| 91 |
3. Default, reference audio text uses the whisper-large-v3-turbo model, which may not always accurately recognize Vietnamese, resulting in poor voice synthesis quality.
|
| 92 |
+
4. Checkpoint is stopped at step 350.000, trained with 1000 hours of public data => Voice cloning for non-native voices may not be perfectly accurate.
|
| 93 |
5. Inference with overly long paragraphs may produce poor results.""",
|
| 94 |
label="❗ Model Limitations",
|
| 95 |
lines=5,
|