import os import gradio as gr from TTS.api import TTS # License Agreement os.environ["COQUI_TOS_AGREED"] = "1" # Model Load (CPU Mode - GPU False) 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 Generation tts.tts_to_file( text=text, speaker_wav=speaker_audio, language="hi", file_path=output_path ) return output_path # Simple Interface demo = gr.Interface( fn=predict, inputs=[ gr.Textbox(label="Text"), gr.Audio(label="Reference Audio", type="filepath") ], outputs=gr.Audio(label="Generated Audio"), ) demo.launch()