Update app.py
Browse files
app.py
CHANGED
|
@@ -1,17 +1,14 @@
|
|
| 1 |
"""
|
| 2 |
PlotweaverNigerianVoice
|
| 3 |
A Gradio Space for the PlotweaverAI Nigerian-English fine-tuned F5-TTS model.
|
| 4 |
-
|
| 5 |
Two modes:
|
| 6 |
1. Default voice: type text -> generated speech using the Nigerian-English
|
| 7 |
voice baked into this Space (sample.wav / sample.txt from the model repo).
|
| 8 |
2. Custom voice clone: upload your own short reference clip (+ transcript,
|
| 9 |
or leave blank to auto-transcribe) -> generated speech in that voice.
|
| 10 |
-
|
| 11 |
Note: F5-TTS's own infer pipeline already auto-transcribes (Whisper, via
|
| 12 |
transformers) and auto-trims reference audio when ref_text is left blank,
|
| 13 |
so we lean on that built-in behavior rather than duplicating it here.
|
| 14 |
-
|
| 15 |
Model: PlotweaverAI/nigerian-english-ft-tts (private HF model repo)
|
| 16 |
Base architecture: F5-TTS (SWivid/F5-TTS)
|
| 17 |
"""
|
|
@@ -33,8 +30,11 @@ except ImportError:
|
|
| 33 |
|
| 34 |
|
| 35 |
def gpu_decorator(func):
|
| 36 |
-
"""
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
| 38 |
return spaces.GPU(func)
|
| 39 |
return func
|
| 40 |
|
|
@@ -189,7 +189,7 @@ CSS = """
|
|
| 189 |
"""
|
| 190 |
|
| 191 |
with gr.Blocks(css=CSS, title="Plotweaver Nigerian Voice") as demo:
|
| 192 |
-
gr.Markdown("#Plotweaver Nigerian Voice", elem_id="title")
|
| 193 |
gr.Markdown(
|
| 194 |
"Nigerian-English text-to-speech, fine-tuned from F5-TTS by Plotweaver AI. "
|
| 195 |
"Generate speech in our Nigerian voice, or clone a voice from your own clip.",
|
|
@@ -203,7 +203,7 @@ with gr.Blocks(css=CSS, title="Plotweaver Nigerian Voice") as demo:
|
|
| 203 |
)
|
| 204 |
|
| 205 |
with gr.Tabs():
|
| 206 |
-
|
| 207 |
with gr.Tab("Nigerian Voice (Text → Speech)"):
|
| 208 |
with gr.Row():
|
| 209 |
with gr.Column(scale=1):
|
|
|
|
| 1 |
"""
|
| 2 |
PlotweaverNigerianVoice
|
| 3 |
A Gradio Space for the PlotweaverAI Nigerian-English fine-tuned F5-TTS model.
|
|
|
|
| 4 |
Two modes:
|
| 5 |
1. Default voice: type text -> generated speech using the Nigerian-English
|
| 6 |
voice baked into this Space (sample.wav / sample.txt from the model repo).
|
| 7 |
2. Custom voice clone: upload your own short reference clip (+ transcript,
|
| 8 |
or leave blank to auto-transcribe) -> generated speech in that voice.
|
|
|
|
| 9 |
Note: F5-TTS's own infer pipeline already auto-transcribes (Whisper, via
|
| 10 |
transformers) and auto-trims reference audio when ref_text is left blank,
|
| 11 |
so we lean on that built-in behavior rather than duplicating it here.
|
|
|
|
| 12 |
Model: PlotweaverAI/nigerian-english-ft-tts (private HF model repo)
|
| 13 |
Base architecture: F5-TTS (SWivid/F5-TTS)
|
| 14 |
"""
|
|
|
|
| 30 |
|
| 31 |
|
| 32 |
def gpu_decorator(func):
|
| 33 |
+
"""Wrap with spaces.GPU only when an actual GPU is present (ZeroGPU).
|
| 34 |
+
On a CPU Space `spaces` still imports, so gating on ON_SPACES alone would
|
| 35 |
+
wrap CPU-only inference in spaces.GPU and raise at call time. Gate on real
|
| 36 |
+
CUDA availability instead."""
|
| 37 |
+
if ON_SPACES and torch.cuda.is_available():
|
| 38 |
return spaces.GPU(func)
|
| 39 |
return func
|
| 40 |
|
|
|
|
| 189 |
"""
|
| 190 |
|
| 191 |
with gr.Blocks(css=CSS, title="Plotweaver Nigerian Voice") as demo:
|
| 192 |
+
gr.Markdown("# Plotweaver Nigerian Voice", elem_id="title")
|
| 193 |
gr.Markdown(
|
| 194 |
"Nigerian-English text-to-speech, fine-tuned from F5-TTS by Plotweaver AI. "
|
| 195 |
"Generate speech in our Nigerian voice, or clone a voice from your own clip.",
|
|
|
|
| 203 |
)
|
| 204 |
|
| 205 |
with gr.Tabs():
|
| 206 |
+
|
| 207 |
with gr.Tab("Nigerian Voice (Text → Speech)"):
|
| 208 |
with gr.Row():
|
| 209 |
with gr.Column(scale=1):
|