File size: 624 Bytes
8531969
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import gradio as gr
from transformers import pipeline

# Load the model from Hugging Face Hub
model_id = "Abhinay45/XTTS-Hindi-finetuned"  # Model identifier
tts_pipeline = pipeline("text-to-speech", model=model_id)

# Define the function that will convert text to speech
def text_to_speech(text):
    audio = tts_pipeline(text)
    return audio["audio"]

# Create a Gradio interface
iface = gr.Interface(
    fn=text_to_speech, 
    inputs="text", 
    outputs="audio", 
    title="Hindi Text-to-Speech",
    description="Enter Hindi text and get the corresponding speech output.",
)

# Launch the interface
iface.launch()