Spaces:
Running
on
Zero
Running
on
Zero
Update deploy.py
Browse files
deploy.py
CHANGED
@@ -1,10 +1,6 @@
|
|
1 |
import logging
|
2 |
-
logging.basicConfig(level=logging.INFO)
|
3 |
-
|
4 |
-
import spaces
|
5 |
-
import os
|
6 |
-
import sys
|
7 |
import subprocess
|
|
|
8 |
|
9 |
def run_shell_script(script_path):
|
10 |
"""
|
@@ -29,59 +25,17 @@ def run_shell_script(script_path):
|
|
29 |
# 假设有一个名为example.sh的脚本文件在当前目录下
|
30 |
run_shell_script('deploy.sh')
|
31 |
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
sys.path.append('{}/third_party/AcademiCodec'.format(ROOT_DIR))
|
36 |
-
sys.path.append('{}/third_party/Matcha-TTS'.format(ROOT_DIR))
|
37 |
-
|
38 |
-
os.system('cd pretrained_models/speech_kantts_ttsfrd/ && pip install ttsfrd_dependency-0.1-py3-none-any.whl')
|
39 |
-
os.system('cd pretrained_models/speech_kantts_ttsfrd/ && pip install ttsfrd-0.3.9-cp310-cp310-linux_x86_64.whl')
|
40 |
-
os.system('sed -i [email protected]@typing_extensions@g /usr/local/lib/python3.10/site-packages/inflect/__init__.py')
|
41 |
-
|
42 |
-
import gradio as gr
|
43 |
-
from css.advanced import advanced
|
44 |
-
from css.custom import custom
|
45 |
-
from css.preset import preset
|
46 |
-
|
47 |
-
audio_mode_choices = [('Preset voice generation', 'preset'), ('Custom voice generation (replicate recorded voice)', 'custom'),
|
48 |
-
('Advanced voice generation (natural language control)', 'advanced')]
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
def on_audio_mode_change(_audio_mode_radio):
|
53 |
-
yield {
|
54 |
-
preset_layout: gr.update(visible=_audio_mode_radio == 'preset'),
|
55 |
-
custom_layout: gr.update(visible=_audio_mode_radio == 'custom'),
|
56 |
-
advanced_layout: gr.update(visible=_audio_mode_radio == 'advanced')
|
57 |
-
}
|
58 |
-
|
59 |
-
|
60 |
-
custom_css = """
|
61 |
-
.full-height {
|
62 |
-
height: 100%;
|
63 |
-
}
|
64 |
-
"""
|
65 |
-
|
66 |
-
default_layout = 'preset'
|
67 |
-
|
68 |
-
with gr.Blocks(theme=gr.themes.Soft(), css=custom_css) as demo:
|
69 |
-
audio_mode_radio = gr.Radio(choices=audio_mode_choices,
|
70 |
-
value=default_layout,
|
71 |
-
label="Select voice generation mode")
|
72 |
-
with gr.Row():
|
73 |
-
with gr.Column(visible=default_layout == 'preset') as preset_layout:
|
74 |
-
preset()
|
75 |
-
with gr.Column(visible=default_layout == 'custom') as custom_layout:
|
76 |
-
custom()
|
77 |
-
with gr.Column(
|
78 |
-
visible=default_layout == 'advanced') as advanced_layout:
|
79 |
-
advanced()
|
80 |
-
|
81 |
-
audio_mode_radio.change(
|
82 |
-
fn=on_audio_mode_change,
|
83 |
-
inputs=[audio_mode_radio],
|
84 |
-
outputs=[preset_layout, custom_layout, advanced_layout])
|
85 |
|
|
|
|
|
|
|
86 |
|
87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import logging
|
|
|
|
|
|
|
|
|
|
|
2 |
import subprocess
|
3 |
+
logging.basicConfig(level=logging.INFO)
|
4 |
|
5 |
def run_shell_script(script_path):
|
6 |
"""
|
|
|
25 |
# 假设有一个名为example.sh的脚本文件在当前目录下
|
26 |
run_shell_script('deploy.sh')
|
27 |
|
28 |
+
class args:
|
29 |
+
def __init__(self):
|
30 |
+
self.port = 5000
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
+
from CosyVoice.webui import main
|
33 |
+
from CosyVoice.cosyvoice.cli.cosyvoice import CosyVoice
|
34 |
+
import numpy as np
|
35 |
|
36 |
+
cosyvoice = CosyVoice("pretrained_models/CosyVoice-300M")
|
37 |
+
sft_spk = cosyvoice.list_avaliable_spks()
|
38 |
+
prompt_sr, target_sr = 16000, 22050
|
39 |
+
default_data = np.zeros(target_sr)
|
40 |
+
args.port = 5000
|
41 |
+
main()
|