Commit
Β·
229bbd8
1
Parent(s):
07fd1a0
debug for hf space
Browse files- indextts/infer.py +0 -2
- webui.py +11 -3
indextts/infer.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
import spaces
|
| 2 |
import os
|
| 3 |
import re
|
| 4 |
import sys
|
|
@@ -16,7 +15,6 @@ from indextts.BigVGAN.models import BigVGAN as Generator
|
|
| 16 |
|
| 17 |
|
| 18 |
class IndexTTS:
|
| 19 |
-
@spaces.GPU(duration=65)
|
| 20 |
def __init__(self, cfg_path='checkpoints/config.yaml', model_dir='checkpoints'):
|
| 21 |
self.cfg = OmegaConf.load(cfg_path)
|
| 22 |
self.device = 'cuda:0'
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
import re
|
| 3 |
import sys
|
|
|
|
| 15 |
|
| 16 |
|
| 17 |
class IndexTTS:
|
|
|
|
| 18 |
def __init__(self, cfg_path='checkpoints/config.yaml', model_dir='checkpoints'):
|
| 19 |
self.cfg = OmegaConf.load(cfg_path)
|
| 20 |
self.device = 'cuda:0'
|
webui.py
CHANGED
|
@@ -18,12 +18,13 @@ from tools.i18n.i18n import I18nAuto
|
|
| 18 |
i18n = I18nAuto(language="zh_CN")
|
| 19 |
MODE = 'local'
|
| 20 |
snapshot_download("IndexTeam/Index-TTS",local_dir="checkpoints",)
|
| 21 |
-
tts =
|
| 22 |
|
| 23 |
os.makedirs("outputs/tasks",exist_ok=True)
|
| 24 |
os.makedirs("prompts",exist_ok=True)
|
| 25 |
|
| 26 |
def infer(voice, text,output_path=None):
|
|
|
|
| 27 |
if not output_path:
|
| 28 |
output_path = os.path.join("outputs", f"spk_{int(time.time())}.wav")
|
| 29 |
tts.infer(voice, text, output_path)
|
|
@@ -67,7 +68,14 @@ with gr.Blocks() as demo:
|
|
| 67 |
inputs=[prompt_audio, input_text_single],
|
| 68 |
outputs=[output_audio])
|
| 69 |
|
| 70 |
-
|
| 71 |
-
|
|
|
|
|
|
|
|
|
|
| 72 |
demo.queue(20)
|
| 73 |
demo.launch(server_name="0.0.0.0")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
i18n = I18nAuto(language="zh_CN")
|
| 19 |
MODE = 'local'
|
| 20 |
snapshot_download("IndexTeam/Index-TTS",local_dir="checkpoints",)
|
| 21 |
+
tts = None
|
| 22 |
|
| 23 |
os.makedirs("outputs/tasks",exist_ok=True)
|
| 24 |
os.makedirs("prompts",exist_ok=True)
|
| 25 |
|
| 26 |
def infer(voice, text,output_path=None):
|
| 27 |
+
|
| 28 |
if not output_path:
|
| 29 |
output_path = os.path.join("outputs", f"spk_{int(time.time())}.wav")
|
| 30 |
tts.infer(voice, text, output_path)
|
|
|
|
| 68 |
inputs=[prompt_audio, input_text_single],
|
| 69 |
outputs=[output_audio])
|
| 70 |
|
| 71 |
+
@spaces.GPU
|
| 72 |
+
def main():
|
| 73 |
+
global tts
|
| 74 |
+
if not tts:
|
| 75 |
+
tts = IndexTTS(model_dir="checkpoints", cfg_path="checkpoints/config.yaml")
|
| 76 |
demo.queue(20)
|
| 77 |
demo.launch(server_name="0.0.0.0")
|
| 78 |
+
|
| 79 |
+
if __name__ == "__main__":
|
| 80 |
+
main()
|
| 81 |
+
|