from TTS.api import TTS import gradio as gr # Load mô hình từ file local (không tải online) tts = TTS(model_path="checkpoint.pth", config_path="config.json") def text_to_speech(text): output_file = "output.wav" # Clone giọng từ file nezuko.wav tts.tts_to_file(text=text, file_path=output_file, speaker_wav="nezuko.wav") return output_file iface = gr.Interface( fn=text_to_speech, inputs=gr.Textbox(label="Nhập văn bản"), outputs=gr.Audio(label="Giọng Anime"), title="TTS Anime Free API" ) iface.launch()