Spaces:
Runtime error
Runtime error
Yunshansongbai
commited on
Commit
•
b3cb31e
1
Parent(s):
b088d52
Update app.py
Browse files
app.py
CHANGED
@@ -12,6 +12,7 @@ import paddle
|
|
12 |
import requests
|
13 |
import utils
|
14 |
from spleeter import Separator
|
|
|
15 |
|
16 |
build_dir=os.getcwd()
|
17 |
if build_dir == "/home/aistudio":
|
@@ -21,6 +22,8 @@ model_dir=build_dir+'/trained_models'
|
|
21 |
|
22 |
model_list_path = model_dir + "/model_list.txt"
|
23 |
|
|
|
|
|
24 |
# 筛选出文件夹
|
25 |
models = []
|
26 |
for filename in os.listdir(model_dir):
|
@@ -30,7 +33,13 @@ for filename in os.listdir(model_dir):
|
|
30 |
cache_model = {}
|
31 |
|
32 |
def reboot():
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
def separate_fn(song_input):
|
36 |
try:
|
@@ -130,7 +139,6 @@ def compose_fn(input_vocal,input_instrumental,mixing_ratio=0.5):
|
|
130 |
app = gr.Blocks()
|
131 |
with app:
|
132 |
gr.Markdown('<h1 style="text-align: center;">SVC歌声转换全流程体验(伴奏分离,转换,混音)</h1>')
|
133 |
-
btn_reboot = gr.Button("重启程序", variant="primary")
|
134 |
with gr.Tabs() as tabs:
|
135 |
with gr.TabItem("人声伴奏分离"):
|
136 |
gr.Markdown('<p>该项目人声分离的效果弱于UVR5,如自备分离好的伴奏和人声可跳过该步骤</p>')
|
@@ -166,6 +174,10 @@ with app:
|
|
166 |
btn_compose = gr.Button("混音", variant="primary")
|
167 |
text_output3 = gr.Textbox(label="输出信息")
|
168 |
song_output = gr.Audio(label="输出歌曲",interactive=False)
|
|
|
|
|
|
|
|
|
169 |
btn_separate.click(separate_fn, song_input, [text_output1, vocal_output1,instrumental_output1,vocal_input1,instrumental_input1])
|
170 |
btn_convert.click(convert_fn, [model_name, vocal_input1,micro_input,vc_transform,auto_f0,cluster_ratio, slice_db, noise_scale], [text_output2, vc_output2,vocal_input2])
|
171 |
btn_compose.click(compose_fn,[vocal_input2,instrumental_input1,mixing_ratio],[text_output3,song_output])
|
|
|
12 |
import requests
|
13 |
import utils
|
14 |
from spleeter import Separator
|
15 |
+
import time
|
16 |
|
17 |
build_dir=os.getcwd()
|
18 |
if build_dir == "/home/aistudio":
|
|
|
22 |
|
23 |
model_list_path = model_dir + "/model_list.txt"
|
24 |
|
25 |
+
start_time = time.time()
|
26 |
+
|
27 |
# 筛选出文件夹
|
28 |
models = []
|
29 |
for filename in os.listdir(model_dir):
|
|
|
33 |
cache_model = {}
|
34 |
|
35 |
def reboot():
|
36 |
+
global start_time
|
37 |
+
if time.time() - start_time >= 3600: # 运行时间大于等于1小时
|
38 |
+
gradio.alert("程序将重启...")
|
39 |
+
os._exit(0)
|
40 |
+
else:
|
41 |
+
remaining_time = int(3600 - (time.time() - start_time)) # 计算剩余时间
|
42 |
+
gradio.alert(f"距离下一次重启还剩{remaining_time}秒")
|
43 |
|
44 |
def separate_fn(song_input):
|
45 |
try:
|
|
|
139 |
app = gr.Blocks()
|
140 |
with app:
|
141 |
gr.Markdown('<h1 style="text-align: center;">SVC歌声转换全流程体验(伴奏分离,转换,混音)</h1>')
|
|
|
142 |
with gr.Tabs() as tabs:
|
143 |
with gr.TabItem("人声伴奏分离"):
|
144 |
gr.Markdown('<p>该项目人声分离的效果弱于UVR5,如自备分离好的伴奏和人声可跳过该步骤</p>')
|
|
|
174 |
btn_compose = gr.Button("混音", variant="primary")
|
175 |
text_output3 = gr.Textbox(label="输出信息")
|
176 |
song_output = gr.Audio(label="输出歌曲",interactive=False)
|
177 |
+
|
178 |
+
with gr.TabItem("设置"):
|
179 |
+
btn_reboot = gr.Button("重启程序", variant="primary")
|
180 |
+
|
181 |
btn_separate.click(separate_fn, song_input, [text_output1, vocal_output1,instrumental_output1,vocal_input1,instrumental_input1])
|
182 |
btn_convert.click(convert_fn, [model_name, vocal_input1,micro_input,vc_transform,auto_f0,cluster_ratio, slice_db, noise_scale], [text_output2, vc_output2,vocal_input2])
|
183 |
btn_compose.click(compose_fn,[vocal_input2,instrumental_input1,mixing_ratio],[text_output3,song_output])
|