Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,19 @@
|
|
| 1 |
from TTS.api import TTS
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
-
|
|
|
|
| 5 |
|
| 6 |
def text_to_speech(text):
|
| 7 |
output_file = "output.wav"
|
|
|
|
| 8 |
tts.tts_to_file(text=text, file_path=output_file, speaker_wav="nezuko.wav")
|
| 9 |
return output_file
|
| 10 |
|
| 11 |
-
iface = gr.Interface(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
iface.launch()
|
|
|
|
| 1 |
from TTS.api import TTS
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
+
# Load mô hình từ file local (không tải online)
|
| 5 |
+
tts = TTS(model_path="checkpoint.pth", config_path="config.json")
|
| 6 |
|
| 7 |
def text_to_speech(text):
|
| 8 |
output_file = "output.wav"
|
| 9 |
+
# Clone giọng từ file nezuko.wav
|
| 10 |
tts.tts_to_file(text=text, file_path=output_file, speaker_wav="nezuko.wav")
|
| 11 |
return output_file
|
| 12 |
|
| 13 |
+
iface = gr.Interface(
|
| 14 |
+
fn=text_to_speech,
|
| 15 |
+
inputs=gr.Textbox(label="Nhập văn bản"),
|
| 16 |
+
outputs=gr.Audio(label="Giọng Anime"),
|
| 17 |
+
title="TTS Anime Free API"
|
| 18 |
+
)
|
| 19 |
iface.launch()
|