amit0987 commited on
Commit
9c07533
Β·
verified Β·
1 Parent(s): 968bd1e

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -0
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # app.py
2
+
3
+ import gradio as gr
4
+ from model_handler import call_model_with_timeout
5
+
6
+ def synthesize(text, ref_audio, ref_text):
7
+ if not ref_audio:
8
+ return "β›” Please upload a reference WAV file", None
9
+
10
+ status, output_path = call_model_with_timeout(text, ref_audio.name, ref_text)
11
+ return status, output_path
12
+
13
+ iface = gr.Interface(
14
+ fn=synthesize,
15
+ inputs=[
16
+ gr.Textbox(label="πŸ“ Hindi Text to Synthesize"),
17
+ gr.Audio(label="🎀 Reference Audio (.wav)", type="file"),
18
+ gr.Textbox(label="πŸ“ Reference Text (Optional)", value="")
19
+ ],
20
+ outputs=[
21
+ gr.Textbox(label="πŸ”” Status"),
22
+ gr.Audio(label="πŸ”Š Synthesized Audio")
23
+ ],
24
+ title="AI4Bharat Hindi TTS (IndicF5)",
25
+ description="Enter Hindi text, upload a reference audio file, and get synthesized output using the Hugging Face AI4Bharat/IndicF5 model."
26
+ )
27
+
28
+ if __name__ == "__main__":
29
+ iface.launch()