Spaces:
Runtime error
Runtime error
Download app.py from Thethinkingmind/README: direct link, hf CLI and curl.
- Browser
- Download file 554 Bytes
-
https://huggingface.co/spaces/Thethinkingmind/README/resolve/main/app.py
- Command line
-
hf download hf://spaces/Thethinkingmind/README/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Thethinkingmind/README/resolve/main/app.py
554 Bytes
| from transformers import pipeline | |
| import gradio as gr | |
| import tempfile | |
| # Load TTS pipeline with a model that works in Spaces | |
| tts = pipeline("text-to-speech", model="facebook/fastspeech2-en-ljspeech") | |
| def greet(name): | |
| greeting = f"Hello {name}!! You're amazing!" | |
| audio_data = tts(greeting)["audio"] | |
| # Save to a temp WAV file | |
| with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as f: | |
| f.write(audio_data) | |
| return f.name | |
| demo = gr.Interface(fn=greet, inputs="text", outputs=gr.Audio(type="filepath")) | |
| demo.launch() |