File size: 825 Bytes
6a1644d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import os
# License agreement bypass
os.environ["COQUI_TOS_AGREED"] = "1"

import gradio as gr
from TTS.api import TTS

# Model Load (CPU Mode)
print("⏳ Model load ho raha hai... Isme 2-3 minute lagenge...")
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2", gpu=False)

def predict(text, speaker_audio):
    output_path = "output.wav"
    # Hindi Text to Speech generation
    tts.tts_to_file(
        text=text,
        speaker_wav=speaker_audio,
        language="hi",
        file_path=output_path
    )
    return output_path

# App Interface
demo = gr.Interface(
    fn=predict,
    inputs=[
        gr.Textbox(label="Hindi Text"),
        gr.Audio(label="Reference Audio (Brian)", type="filepath")
    ],
    outputs=gr.Audio(label="Generated Audio"),
    title="Jobssphere AI Voice Engine"
)

demo.launch()