Update app.py
Browse files
app.py
CHANGED
|
@@ -40,4 +40,21 @@ def tts_fn(text, language):
|
|
| 40 |
try:
|
| 41 |
tts = pipeline("text-to-speech", model=model_id)
|
| 42 |
out = tts(text)
|
| 43 |
-
return f"✅ Model: {model_id}", (out["audio"], "output.wav
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
try:
|
| 41 |
tts = pipeline("text-to-speech", model=model_id)
|
| 42 |
out = tts(text)
|
| 43 |
+
return f"✅ Model: {model_id}", (out["audio"], "output.wav")
|
| 44 |
+
except Exception as e:
|
| 45 |
+
return f"❌ Error: {str(e)}", None
|
| 46 |
+
|
| 47 |
+
with gr.Blocks() as demo:
|
| 48 |
+
gr.Markdown("# 🌐 MMS-TTS: 1100+ Languages (No ISO Code Needed)")
|
| 49 |
+
with gr.Row():
|
| 50 |
+
language = gr.Textbox(label="Enter language name (e.g., Meadow Mari)", placeholder="Type a language name...")
|
| 51 |
+
text = gr.Textbox(label="Enter your text", placeholder="Type something here...")
|
| 52 |
+
with gr.Row():
|
| 53 |
+
btn = gr.Button("Speak")
|
| 54 |
+
with gr.Row():
|
| 55 |
+
out_text = gr.Textbox(label="Info")
|
| 56 |
+
out_audio = gr.Audio(label="Audio", type="filepath")
|
| 57 |
+
|
| 58 |
+
btn.click(fn=tts_fn, inputs=[text, language], outputs=[out_text, out_audio])
|
| 59 |
+
|
| 60 |
+
demo.launch()
|