File size: 556 Bytes
68f241a
 
 
2c60c86
 
68f241a
 
 
2c60c86
68f241a
 
 
2c60c86
 
 
 
 
 
68f241a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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()