Prince1singh's picture
Create app.py
6a1644d verified
raw
history blame contribute delete
825 Bytes
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()