tudeplom commited on
Commit
2c60c86
·
verified ·
1 Parent(s): 36ac3d4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -1,12 +1,19 @@
1
  from TTS.api import TTS
2
  import gradio as gr
3
 
4
- tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2")
 
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(fn=text_to_speech, inputs="text", outputs="audio")
 
 
 
 
 
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()