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()