Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -978,473 +978,3 @@ def audio_downloader(
|
|
978 |
return download_path
|
979 |
|
980 |
|
981 |
-
def downloader_conf():
|
982 |
-
return gr.Checkbox(
|
983 |
-
False,
|
984 |
-
label="URL-to-Audio",
|
985 |
-
# info="",
|
986 |
-
container=False,
|
987 |
-
)
|
988 |
-
|
989 |
-
|
990 |
-
def url_media_conf():
|
991 |
-
return gr.Textbox(
|
992 |
-
value="",
|
993 |
-
label="Enter URL",
|
994 |
-
placeholder="www.youtube.com/watch?v=g_9rPvbENUw",
|
995 |
-
visible=False,
|
996 |
-
lines=1,
|
997 |
-
)
|
998 |
-
|
999 |
-
|
1000 |
-
def url_button_conf():
|
1001 |
-
return gr.Button(
|
1002 |
-
"Go",
|
1003 |
-
variant="secondary",
|
1004 |
-
visible=False,
|
1005 |
-
)
|
1006 |
-
|
1007 |
-
|
1008 |
-
def show_components_downloader(value_active):
|
1009 |
-
return gr.update(
|
1010 |
-
visible=value_active
|
1011 |
-
), gr.update(
|
1012 |
-
visible=value_active
|
1013 |
-
)
|
1014 |
-
|
1015 |
-
|
1016 |
-
def audio_conf():
|
1017 |
-
return gr.File(
|
1018 |
-
label="Audio file",
|
1019 |
-
# file_count="multiple",
|
1020 |
-
type="filepath",
|
1021 |
-
container=True,
|
1022 |
-
)
|
1023 |
-
|
1024 |
-
|
1025 |
-
def stem_conf():
|
1026 |
-
return gr.Radio(
|
1027 |
-
choices=["vocal", "background"],
|
1028 |
-
value="vocal",
|
1029 |
-
label="Stem",
|
1030 |
-
# info="",
|
1031 |
-
)
|
1032 |
-
|
1033 |
-
|
1034 |
-
def main_conf():
|
1035 |
-
return gr.Checkbox(
|
1036 |
-
False,
|
1037 |
-
label="Main",
|
1038 |
-
# info="",
|
1039 |
-
)
|
1040 |
-
|
1041 |
-
|
1042 |
-
def dereverb_conf():
|
1043 |
-
return gr.Checkbox(
|
1044 |
-
False,
|
1045 |
-
label="Dereverb",
|
1046 |
-
# info="",
|
1047 |
-
visible=True,
|
1048 |
-
)
|
1049 |
-
|
1050 |
-
|
1051 |
-
def vocal_effects_conf():
|
1052 |
-
return gr.Checkbox(
|
1053 |
-
False,
|
1054 |
-
label="Vocal Effects",
|
1055 |
-
# info="",
|
1056 |
-
visible=True,
|
1057 |
-
)
|
1058 |
-
|
1059 |
-
|
1060 |
-
def background_effects_conf():
|
1061 |
-
return gr.Checkbox(
|
1062 |
-
False,
|
1063 |
-
label="Background Effects",
|
1064 |
-
# info="",
|
1065 |
-
visible=False,
|
1066 |
-
)
|
1067 |
-
|
1068 |
-
|
1069 |
-
def vocal_reverb_room_size_conf():
|
1070 |
-
return gr.Number(
|
1071 |
-
0.15,
|
1072 |
-
label="Vocal Reverb Room Size",
|
1073 |
-
minimum=0.0,
|
1074 |
-
maximum=1.0,
|
1075 |
-
step=0.05,
|
1076 |
-
visible=True,
|
1077 |
-
)
|
1078 |
-
|
1079 |
-
|
1080 |
-
def vocal_reverb_damping_conf():
|
1081 |
-
return gr.Number(
|
1082 |
-
0.7,
|
1083 |
-
label="Vocal Reverb Damping",
|
1084 |
-
minimum=0.0,
|
1085 |
-
maximum=1.0,
|
1086 |
-
step=0.01,
|
1087 |
-
visible=True,
|
1088 |
-
)
|
1089 |
-
|
1090 |
-
|
1091 |
-
def vocal_reverb_wet_level_conf():
|
1092 |
-
return gr.Number(
|
1093 |
-
0.2,
|
1094 |
-
label="Vocal Reverb Wet Level",
|
1095 |
-
minimum=0.0,
|
1096 |
-
maximum=1.0,
|
1097 |
-
step=0.05,
|
1098 |
-
visible=True,
|
1099 |
-
)
|
1100 |
-
|
1101 |
-
|
1102 |
-
def vocal_reverb_dryness_level_conf():
|
1103 |
-
return gr.Number(
|
1104 |
-
0.8,
|
1105 |
-
label="Vocal Reverb Dryness Level",
|
1106 |
-
minimum=0.0,
|
1107 |
-
maximum=1.0,
|
1108 |
-
step=0.05,
|
1109 |
-
visible=True,
|
1110 |
-
)
|
1111 |
-
|
1112 |
-
|
1113 |
-
def vocal_delay_seconds_conf():
|
1114 |
-
return gr.Number(
|
1115 |
-
0.,
|
1116 |
-
label="Vocal Delay Seconds",
|
1117 |
-
minimum=0.0,
|
1118 |
-
maximum=1.0,
|
1119 |
-
step=0.01,
|
1120 |
-
visible=True,
|
1121 |
-
)
|
1122 |
-
|
1123 |
-
|
1124 |
-
def vocal_delay_mix_conf():
|
1125 |
-
return gr.Number(
|
1126 |
-
0.,
|
1127 |
-
label="Vocal Delay Mix",
|
1128 |
-
minimum=0.0,
|
1129 |
-
maximum=1.0,
|
1130 |
-
step=0.01,
|
1131 |
-
visible=True,
|
1132 |
-
)
|
1133 |
-
|
1134 |
-
|
1135 |
-
def vocal_compressor_threshold_db_conf():
|
1136 |
-
return gr.Number(
|
1137 |
-
-15,
|
1138 |
-
label="Vocal Compressor Threshold (dB)",
|
1139 |
-
minimum=-60,
|
1140 |
-
maximum=0,
|
1141 |
-
step=1,
|
1142 |
-
visible=True,
|
1143 |
-
)
|
1144 |
-
|
1145 |
-
|
1146 |
-
def vocal_compressor_ratio_conf():
|
1147 |
-
return gr.Number(
|
1148 |
-
4.,
|
1149 |
-
label="Vocal Compressor Ratio",
|
1150 |
-
minimum=0,
|
1151 |
-
maximum=20,
|
1152 |
-
step=0.1,
|
1153 |
-
visible=True,
|
1154 |
-
)
|
1155 |
-
|
1156 |
-
|
1157 |
-
def vocal_compressor_attack_ms_conf():
|
1158 |
-
return gr.Number(
|
1159 |
-
1.0,
|
1160 |
-
label="Vocal Compressor Attack (ms)",
|
1161 |
-
minimum=0,
|
1162 |
-
maximum=1000,
|
1163 |
-
step=1,
|
1164 |
-
visible=True,
|
1165 |
-
)
|
1166 |
-
|
1167 |
-
|
1168 |
-
def vocal_compressor_release_ms_conf():
|
1169 |
-
return gr.Number(
|
1170 |
-
100,
|
1171 |
-
label="Vocal Compressor Release (ms)",
|
1172 |
-
minimum=0,
|
1173 |
-
maximum=3000,
|
1174 |
-
step=1,
|
1175 |
-
visible=True,
|
1176 |
-
)
|
1177 |
-
|
1178 |
-
|
1179 |
-
def vocal_gain_db_conf():
|
1180 |
-
return gr.Number(
|
1181 |
-
0,
|
1182 |
-
label="Vocal Gain (dB)",
|
1183 |
-
minimum=-40,
|
1184 |
-
maximum=40,
|
1185 |
-
step=1,
|
1186 |
-
visible=True,
|
1187 |
-
)
|
1188 |
-
|
1189 |
-
|
1190 |
-
def background_highpass_freq_conf():
|
1191 |
-
return gr.Number(
|
1192 |
-
120,
|
1193 |
-
label="Background Highpass Frequency (Hz)",
|
1194 |
-
minimum=0,
|
1195 |
-
maximum=1000,
|
1196 |
-
step=1,
|
1197 |
-
visible=True,
|
1198 |
-
)
|
1199 |
-
|
1200 |
-
|
1201 |
-
def background_lowpass_freq_conf():
|
1202 |
-
return gr.Number(
|
1203 |
-
11000,
|
1204 |
-
label="Background Lowpass Frequency (Hz)",
|
1205 |
-
minimum=0,
|
1206 |
-
maximum=20000,
|
1207 |
-
step=1,
|
1208 |
-
visible=True,
|
1209 |
-
)
|
1210 |
-
|
1211 |
-
|
1212 |
-
def background_reverb_room_size_conf():
|
1213 |
-
return gr.Number(
|
1214 |
-
0.1,
|
1215 |
-
label="Background Reverb Room Size",
|
1216 |
-
minimum=0.0,
|
1217 |
-
maximum=1.0,
|
1218 |
-
step=0.1,
|
1219 |
-
visible=True,
|
1220 |
-
)
|
1221 |
-
|
1222 |
-
|
1223 |
-
def background_reverb_damping_conf():
|
1224 |
-
return gr.Number(
|
1225 |
-
0.5,
|
1226 |
-
label="Background Reverb Damping",
|
1227 |
-
minimum=0.0,
|
1228 |
-
maximum=1.0,
|
1229 |
-
step=0.1,
|
1230 |
-
visible=True,
|
1231 |
-
)
|
1232 |
-
|
1233 |
-
|
1234 |
-
def background_reverb_wet_level_conf():
|
1235 |
-
return gr.Number(
|
1236 |
-
0.25,
|
1237 |
-
label="Background Reverb Wet Level",
|
1238 |
-
minimum=0.0,
|
1239 |
-
maximum=1.0,
|
1240 |
-
step=0.05,
|
1241 |
-
visible=True,
|
1242 |
-
)
|
1243 |
-
|
1244 |
-
|
1245 |
-
def background_compressor_threshold_db_conf():
|
1246 |
-
return gr.Number(
|
1247 |
-
-15,
|
1248 |
-
label="Background Compressor Threshold (dB)",
|
1249 |
-
minimum=-60,
|
1250 |
-
maximum=0,
|
1251 |
-
step=1,
|
1252 |
-
visible=True,
|
1253 |
-
)
|
1254 |
-
|
1255 |
-
|
1256 |
-
def background_compressor_ratio_conf():
|
1257 |
-
return gr.Number(
|
1258 |
-
4.,
|
1259 |
-
label="Background Compressor Ratio",
|
1260 |
-
minimum=0,
|
1261 |
-
maximum=20,
|
1262 |
-
step=0.1,
|
1263 |
-
visible=True,
|
1264 |
-
)
|
1265 |
-
|
1266 |
-
|
1267 |
-
def background_compressor_attack_ms_conf():
|
1268 |
-
return gr.Number(
|
1269 |
-
15,
|
1270 |
-
label="Background Compressor Attack (ms)",
|
1271 |
-
minimum=0,
|
1272 |
-
maximum=1000,
|
1273 |
-
step=1,
|
1274 |
-
visible=True,
|
1275 |
-
)
|
1276 |
-
|
1277 |
-
|
1278 |
-
def background_compressor_release_ms_conf():
|
1279 |
-
return gr.Number(
|
1280 |
-
60,
|
1281 |
-
label="Background Compressor Release (ms)",
|
1282 |
-
minimum=0,
|
1283 |
-
maximum=3000,
|
1284 |
-
step=1,
|
1285 |
-
visible=True,
|
1286 |
-
)
|
1287 |
-
|
1288 |
-
|
1289 |
-
def background_gain_db_conf():
|
1290 |
-
return gr.Number(
|
1291 |
-
0,
|
1292 |
-
label="Background Gain (dB)",
|
1293 |
-
minimum=-40,
|
1294 |
-
maximum=40,
|
1295 |
-
step=1,
|
1296 |
-
visible=True,
|
1297 |
-
)
|
1298 |
-
|
1299 |
-
|
1300 |
-
def button_conf():
|
1301 |
-
return gr.Button(
|
1302 |
-
"Inference",
|
1303 |
-
variant="primary",
|
1304 |
-
)
|
1305 |
-
|
1306 |
-
|
1307 |
-
def output_conf():
|
1308 |
-
return gr.File(
|
1309 |
-
label="Result",
|
1310 |
-
file_count="multiple",
|
1311 |
-
interactive=False,
|
1312 |
-
)
|
1313 |
-
|
1314 |
-
|
1315 |
-
def show_vocal_components(value_name):
|
1316 |
-
|
1317 |
-
if value_name == "vocal":
|
1318 |
-
return gr.update(visible=True), gr.update(
|
1319 |
-
visible=True
|
1320 |
-
), gr.update(visible=True), gr.update(
|
1321 |
-
visible=False
|
1322 |
-
)
|
1323 |
-
else:
|
1324 |
-
return gr.update(visible=False), gr.update(
|
1325 |
-
visible=False
|
1326 |
-
), gr.update(visible=False), gr.update(
|
1327 |
-
visible=True
|
1328 |
-
)
|
1329 |
-
|
1330 |
-
|
1331 |
-
def get_gui(theme):
|
1332 |
-
with gr.Blocks(theme="hev832/Applio") as app:
|
1333 |
-
gr.Markdown(title)
|
1334 |
-
with gr.Accordion("read this", open=False):
|
1335 |
-
gr.Markdown(description)
|
1336 |
-
|
1337 |
-
downloader_gui = downloader_conf()
|
1338 |
-
with gr.Row():
|
1339 |
-
with gr.Column(scale=2):
|
1340 |
-
url_media_gui = url_media_conf()
|
1341 |
-
with gr.Column(scale=1):
|
1342 |
-
url_button_gui = url_button_conf()
|
1343 |
-
|
1344 |
-
downloader_gui.change(
|
1345 |
-
show_components_downloader,
|
1346 |
-
[downloader_gui],
|
1347 |
-
[url_media_gui, url_button_gui]
|
1348 |
-
)
|
1349 |
-
|
1350 |
-
aud = audio_conf()
|
1351 |
-
|
1352 |
-
url_button_gui.click(
|
1353 |
-
audio_downloader,
|
1354 |
-
[url_media_gui],
|
1355 |
-
[aud]
|
1356 |
-
)
|
1357 |
-
|
1358 |
-
with gr.Column():
|
1359 |
-
with gr.Row():
|
1360 |
-
stem_gui = stem_conf()
|
1361 |
-
|
1362 |
-
with gr.Column():
|
1363 |
-
with gr.Row():
|
1364 |
-
main_gui = main_conf()
|
1365 |
-
dereverb_gui = dereverb_conf()
|
1366 |
-
vocal_effects_gui = vocal_effects_conf()
|
1367 |
-
background_effects_gui = background_effects_conf()
|
1368 |
-
|
1369 |
-
# with gr.Column():
|
1370 |
-
with gr.Accordion("Vocal Effects Parameters", open=False): # with gr.Row():
|
1371 |
-
# gr.Label("Vocal Effects Parameters")
|
1372 |
-
with gr.Row():
|
1373 |
-
vocal_reverb_room_size_gui = vocal_reverb_room_size_conf()
|
1374 |
-
vocal_reverb_damping_gui = vocal_reverb_damping_conf()
|
1375 |
-
vocal_reverb_dryness_gui = vocal_reverb_dryness_level_conf()
|
1376 |
-
vocal_reverb_wet_level_gui = vocal_reverb_wet_level_conf()
|
1377 |
-
vocal_delay_seconds_gui = vocal_delay_seconds_conf()
|
1378 |
-
vocal_delay_mix_gui = vocal_delay_mix_conf()
|
1379 |
-
vocal_compressor_threshold_db_gui = vocal_compressor_threshold_db_conf()
|
1380 |
-
vocal_compressor_ratio_gui = vocal_compressor_ratio_conf()
|
1381 |
-
vocal_compressor_attack_ms_gui = vocal_compressor_attack_ms_conf()
|
1382 |
-
vocal_compressor_release_ms_gui = vocal_compressor_release_ms_conf()
|
1383 |
-
vocal_gain_db_gui = vocal_gain_db_conf()
|
1384 |
-
|
1385 |
-
with gr.Accordion("Background Effects Parameters", open=False): # with gr.Row():
|
1386 |
-
# gr.Label("Background Effects Parameters")
|
1387 |
-
with gr.Row():
|
1388 |
-
background_highpass_freq_gui = background_highpass_freq_conf()
|
1389 |
-
background_lowpass_freq_gui = background_lowpass_freq_conf()
|
1390 |
-
background_reverb_room_size_gui = background_reverb_room_size_conf()
|
1391 |
-
background_reverb_damping_gui = background_reverb_damping_conf()
|
1392 |
-
background_reverb_wet_level_gui = background_reverb_wet_level_conf()
|
1393 |
-
background_compressor_threshold_db_gui = background_compressor_threshold_db_conf()
|
1394 |
-
background_compressor_ratio_gui = background_compressor_ratio_conf()
|
1395 |
-
background_compressor_attack_ms_gui = background_compressor_attack_ms_conf()
|
1396 |
-
background_compressor_release_ms_gui = background_compressor_release_ms_conf()
|
1397 |
-
background_gain_db_gui = background_gain_db_conf()
|
1398 |
-
|
1399 |
-
stem_gui.change(
|
1400 |
-
show_vocal_components,
|
1401 |
-
[stem_gui],
|
1402 |
-
[main_gui, dereverb_gui, vocal_effects_gui, background_effects_gui],
|
1403 |
-
)
|
1404 |
-
|
1405 |
-
button_base = button_conf()
|
1406 |
-
output_base = output_conf()
|
1407 |
-
|
1408 |
-
button_base.click(
|
1409 |
-
sound_separate,
|
1410 |
-
inputs=[
|
1411 |
-
aud,
|
1412 |
-
stem_gui,
|
1413 |
-
main_gui,
|
1414 |
-
dereverb_gui,
|
1415 |
-
vocal_effects_gui,
|
1416 |
-
background_effects_gui,
|
1417 |
-
vocal_reverb_room_size_gui, vocal_reverb_damping_gui, vocal_reverb_dryness_gui, vocal_reverb_wet_level_gui,
|
1418 |
-
vocal_delay_seconds_gui, vocal_delay_mix_gui, vocal_compressor_threshold_db_gui, vocal_compressor_ratio_gui,
|
1419 |
-
vocal_compressor_attack_ms_gui, vocal_compressor_release_ms_gui, vocal_gain_db_gui,
|
1420 |
-
background_highpass_freq_gui, background_lowpass_freq_gui, background_reverb_room_size_gui,
|
1421 |
-
background_reverb_damping_gui, background_reverb_wet_level_gui, background_compressor_threshold_db_gui,
|
1422 |
-
background_compressor_ratio_gui, background_compressor_attack_ms_gui, background_compressor_release_ms_gui,
|
1423 |
-
background_gain_db_gui,
|
1424 |
-
],
|
1425 |
-
outputs=[output_base],
|
1426 |
-
)
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
return app
|
1431 |
-
|
1432 |
-
|
1433 |
-
if __name__ == "__main__":
|
1434 |
-
|
1435 |
-
for id_model in UVR_MODELS:
|
1436 |
-
download_manager(
|
1437 |
-
os.path.join(MDX_DOWNLOAD_LINK, id_model), mdxnet_models_dir
|
1438 |
-
)
|
1439 |
-
|
1440 |
-
app = get_gui(theme)
|
1441 |
-
|
1442 |
-
app.queue(default_concurrency_limit=40)
|
1443 |
-
|
1444 |
-
app.launch(
|
1445 |
-
max_threads=40,
|
1446 |
-
share=True,
|
1447 |
-
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