vinayaggarwal5050 commited on
Commit
8531969
1 Parent(s): 8e221ee

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Load the model from Hugging Face Hub
5
+ model_id = "Abhinay45/XTTS-Hindi-finetuned" # Model identifier
6
+ tts_pipeline = pipeline("text-to-speech", model=model_id)
7
+
8
+ # Define the function that will convert text to speech
9
+ def text_to_speech(text):
10
+ audio = tts_pipeline(text)
11
+ return audio["audio"]
12
+
13
+ # Create a Gradio interface
14
+ iface = gr.Interface(
15
+ fn=text_to_speech,
16
+ inputs="text",
17
+ outputs="audio",
18
+ title="Hindi Text-to-Speech",
19
+ description="Enter Hindi text and get the corresponding speech output.",
20
+ )
21
+
22
+ # Launch the interface
23
+ iface.launch()