File size: 503 Bytes
6b761b4
4342a17
6b761b4
4342a17
0876f14
4342a17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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()