Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from transformers import pipeline | |
| # Load the TTS model | |
| tts = pipeline("text-to-speech", model="Nithu/text-to-speech") | |
| def text_to_speech(text): | |
| # Generate speech from text | |
| audio = tts(text) | |
| return audio["audio"] | |
| # Create a Gradio interface | |
| iface = gr.Interface( | |
| fn=text_to_speech, | |
| inputs="text", | |
| outputs="audio", | |
| title="Text to Speech", | |
| description="Convert text to speech using Hugging Face Transformers." | |
| ) | |
| # Launch the interface | |
| iface.launch() | |