Spaces:
Runtime error
Runtime error
Download app.py from HyperAmigos/AmigosTTS: direct link, hf CLI and curl.
- Browser
- Download file 766 Bytes
-
https://huggingface.co/spaces/HyperAmigos/AmigosTTS/resolve/main/app.py
- Command line
-
hf download hf://spaces/HyperAmigos/AmigosTTS/app.py
-
curl -L -o app.py https://huggingface.co/spaces/HyperAmigos/AmigosTTS/resolve/main/app.py
766 Bytes
| import io | |
| from TTS.utils.synthesizer import Synthesizer | |
| import gradio as gr | |
| # Download and initialize model | |
| synthesizer = Synthesizer( | |
| tts_checkpoint=model_path, | |
| tts_config_path=config_path, | |
| tts_speakers_file=speakers_file_path, | |
| tts_languages_file=None, | |
| vocoder_checkpoint=vocoder_path, | |
| vocoder_config=vocoder_config_path, | |
| encoder_checkpoint="", | |
| encoder_config="", | |
| use_cuda=args.use_cuda, | |
| ) | |
| def generate_tts(text): | |
| wav = synthesizer.tts(text) | |
| out = io.BytesIO() | |
| synthesizer.save_wav(wav, out) | |
| out.seek(0) | |
| return out | |
| iface = gr.Interface( | |
| fn=generate_tts, | |
| inputs=gr.Textbox(label="Enter text"), | |
| outputs=gr.Audio(type="filepath", label="Generated Audio"), | |
| title="Amigos TTS" | |
| ) | |
| iface.launch() | |