Prince1singh commited on
Commit
6a1644d
·
verified ·
1 Parent(s): 68e24eb

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -0
app.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ # License agreement bypass
3
+ os.environ["COQUI_TOS_AGREED"] = "1"
4
+
5
+ import gradio as gr
6
+ from TTS.api import TTS
7
+
8
+ # Model Load (CPU Mode)
9
+ print("⏳ Model load ho raha hai... Isme 2-3 minute lagenge...")
10
+ tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2", gpu=False)
11
+
12
+ def predict(text, speaker_audio):
13
+ output_path = "output.wav"
14
+ # Hindi Text to Speech generation
15
+ tts.tts_to_file(
16
+ text=text,
17
+ speaker_wav=speaker_audio,
18
+ language="hi",
19
+ file_path=output_path
20
+ )
21
+ return output_path
22
+
23
+ # App Interface
24
+ demo = gr.Interface(
25
+ fn=predict,
26
+ inputs=[
27
+ gr.Textbox(label="Hindi Text"),
28
+ gr.Audio(label="Reference Audio (Brian)", type="filepath")
29
+ ],
30
+ outputs=gr.Audio(label="Generated Audio"),
31
+ title="Jobssphere AI Voice Engine"
32
+ )
33
+
34
+ demo.launch()