Update app.py
Browse files
app.py
CHANGED
@@ -196,14 +196,20 @@ def remove_audio_file_from_directory():
|
|
196 |
os.remove(w)
|
197 |
return gr.Info("File removed.")
|
198 |
|
199 |
-
def mvsep_api_request(mvsep_key, audio_file,
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
url = "https://mvsep.com/api/separation/create"
|
201 |
files = {
|
202 |
"audiofile": open(audio_file, 'rb')
|
203 |
}
|
204 |
data = {
|
205 |
"api_token": mvsep_key,
|
206 |
-
"sep_type":
|
207 |
}
|
208 |
r = requests.post(url, files=files, data=data)
|
209 |
json_format = r.json()
|
@@ -232,60 +238,19 @@ def mvsep_download_separated_audio(hash_textbox):
|
|
232 |
}
|
233 |
r = requests.get(url, params=params)
|
234 |
rjson = r.json()
|
|
|
235 |
files = rjson.get('data', {}).get('files', [])
|
236 |
urls = [file['url'] for file in files]
|
|
|
|
|
237 |
return json.dumps(urls, indent=4)
|
238 |
except requests.exceptions.JSONDecodeError:
|
239 |
return gr.Info("Nothing to download yet. Check back later.")
|
240 |
-
|
241 |
-
def mvsep_list_available_models():
|
242 |
-
return [
|
243 |
-
"0 - spleeter (vocals, music)",
|
244 |
-
"1 - spleeter (vocals, drums, bass, other)",
|
245 |
-
"2 - spleeter (vocals, drums, bass, piano, other)",
|
246 |
-
"3 - unmix XL (vocals, drums, bass, other)",
|
247 |
-
"4 - unmix HQ (vocals, drums, bass, other)",
|
248 |
-
"5 - unmix SD (vocals, drums, bass, other)",
|
249 |
-
"6 - unmix SE (vocals, music)",
|
250 |
-
"7 - MDX A (vocals, drums, bass, other)",
|
251 |
-
"8 - MDX B (vocals, drums, bass, other)",
|
252 |
-
"9 - UVR HQ (vocals, music)",
|
253 |
-
"10 - Demucs3 Model A (vocals, drums, bass, other)",
|
254 |
-
"11 - Demucs3 Model B (vocals, drums, bass, other)",
|
255 |
-
"12 - MDX-B Karaoke (lead/back vocals)",
|
256 |
-
"13 - Demucs2 (vocals, drums, bass, other)",
|
257 |
-
"14 - Zero Shot (Query Based) (LQ)",
|
258 |
-
"15 - Danna sep (vocals, drums, bass, other)",
|
259 |
-
"16 - Byte Dance (vocals, drums, bass, other)",
|
260 |
-
"17 - UVRv5 Demucs (vocals, music)",
|
261 |
-
"18 - MVSep DNR (music, sfx, speech)",
|
262 |
-
"19 - MVSep Vocal Model (vocals, music)",
|
263 |
-
"20 - Demucs4 HT (vocals, drums, bass, other)",
|
264 |
-
"22 - FoxJoy Reverb Removal (other)",
|
265 |
-
"23 - MDX B (vocals, instrumental)",
|
266 |
-
"24 - MVSep Demucs4HT DNR (dialog, sfx, music)",
|
267 |
-
"25 - MDX23C (vocals, instrumental)",
|
268 |
-
"26 - Ensemble (vocals, instrumental) [PREMIUM ONLY]",
|
269 |
-
"27 - Demucs4 Vocals 2023 (vocals, instrumental)",
|
270 |
-
"28 - Ensemble (vocals, instrumental, bass, drums, other) [PREMIUM ONLY]",
|
271 |
-
"29 - MVSep Piano (piano, other)",
|
272 |
-
"30 - Ensemble All-In (vocals, bass, drums, piano, guitar, lead/back vocals, other) [PREMIUM ONLY]",
|
273 |
-
"31 - MVSep Guitar (guitar, other)",
|
274 |
-
"33 - Vit Large 23 (vocals, instrum)",
|
275 |
-
"34 - MVSep Crowd removal (crowd, other)",
|
276 |
-
"35 - MVSep MelBand Roformer (vocals, instrum)",
|
277 |
-
"36 - BandIt Plus (speech, music, effects)",
|
278 |
-
"37 - DrumSep (kick, snare, cymbals, toms)",
|
279 |
-
"38 - LarsNet (kick, snare, cymbals, toms, hihat)",
|
280 |
-
"39 - Whisper (extract text from audio)",
|
281 |
-
"40 - BS Roformer (vocals, instrumental)",
|
282 |
-
"41 - MVSep Bass (bass, other)"
|
283 |
-
]
|
284 |
|
285 |
|
286 |
with gr.Blocks(theme='sudeepshouche/minimalist', title="Global Dataset Maker") as app:
|
287 |
gr.HTML(
|
288 |
-
"<h1> Welcome to the
|
289 |
)
|
290 |
gr.Markdown("## Duplicate this space if you want to make your own changes!")
|
291 |
gr.HTML(
|
@@ -385,19 +350,61 @@ with gr.Blocks(theme='sudeepshouche/minimalist', title="Global Dataset Maker") a
|
|
385 |
with gr.Row():
|
386 |
mvsep_key = gr.Textbox(placeholder="Enter your MVSEP API key.", label="API key")
|
387 |
audio_file = gr.File(file_count='single', file_types=[".mp3"], label="Audio file")
|
388 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
389 |
send_req = gr.Button("Send request", variant='primary')
|
390 |
-
get_available_models = gr.Button("Get available models", variant='secondary')
|
391 |
send_req.click(
|
392 |
mvsep_api_request,
|
393 |
-
[mvsep_key, audio_file,
|
394 |
[gr.Text(label="Output")]
|
395 |
)
|
396 |
-
get_available_models.click(
|
397 |
-
mvsep_list_available_models,
|
398 |
-
None,
|
399 |
-
[gr.Text(label="Models")]
|
400 |
-
)
|
401 |
with gr.Tab("Get status of request"):
|
402 |
with gr.Row():
|
403 |
with gr.Column():
|
@@ -417,12 +424,8 @@ with gr.Blocks(theme='sudeepshouche/minimalist', title="Global Dataset Maker") a
|
|
417 |
)
|
418 |
|
419 |
with gr.TabItem("Changelog"):
|
420 |
-
gr.Markdown("v0.99.5 -
|
421 |
gr.Markdown("v0.99.4 - Added a button to display the available models for MVSEP.")
|
422 |
gr.Markdown("v0.99.3 - Added MVSEP in Misc Tools. This is VERY EXPERIMENTAL and there will be bugs present.")
|
423 |
-
gr.Markdown("v0.99.2 - Added an mp4 file converter.")
|
424 |
-
gr.Markdown("v0.99.1 - Removed very old tools (including the 'Upcoming Features' tab) that did not fit with the nature of the program.")
|
425 |
-
gr.Markdown("v0.99 - Added 'Strict Duration' mode for the file splitter.")
|
426 |
-
gr.Markdown("v0.98.2 - Added new upcoming features tab.")
|
427 |
|
428 |
app.launch()
|
|
|
196 |
os.remove(w)
|
197 |
return gr.Info("File removed.")
|
198 |
|
199 |
+
def mvsep_api_request(mvsep_key, audio_file, sep_dropdown):
|
200 |
+
if mvsep_key == "":
|
201 |
+
return gr.Warning("You must have an MVSEP API key for this to work!")
|
202 |
+
if audio_file == None:
|
203 |
+
return gr.Warning("Please select an audio file!")
|
204 |
+
if sep_dropdown == "-------------------------------------------------------------------------------------------------":
|
205 |
+
return gr.Warning("This option is not a model!")
|
206 |
url = "https://mvsep.com/api/separation/create"
|
207 |
files = {
|
208 |
"audiofile": open(audio_file, 'rb')
|
209 |
}
|
210 |
data = {
|
211 |
"api_token": mvsep_key,
|
212 |
+
"sep_type": sep_dropdown
|
213 |
}
|
214 |
r = requests.post(url, files=files, data=data)
|
215 |
json_format = r.json()
|
|
|
238 |
}
|
239 |
r = requests.get(url, params=params)
|
240 |
rjson = r.json()
|
241 |
+
status = rjson['status']
|
242 |
files = rjson.get('data', {}).get('files', [])
|
243 |
urls = [file['url'] for file in files]
|
244 |
+
if status == "waiting" or status == "processing":
|
245 |
+
return gr.Info("Job not finished yet, so nothing to download for now.")
|
246 |
return json.dumps(urls, indent=4)
|
247 |
except requests.exceptions.JSONDecodeError:
|
248 |
return gr.Info("Nothing to download yet. Check back later.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
|
250 |
|
251 |
with gr.Blocks(theme='sudeepshouche/minimalist', title="Global Dataset Maker") as app:
|
252 |
gr.HTML(
|
253 |
+
"<h1> Welcome to the GDMGS! (GlobalDatasetMaker Gradio Space) </h1>"
|
254 |
)
|
255 |
gr.Markdown("## Duplicate this space if you want to make your own changes!")
|
256 |
gr.HTML(
|
|
|
350 |
with gr.Row():
|
351 |
mvsep_key = gr.Textbox(placeholder="Enter your MVSEP API key.", label="API key")
|
352 |
audio_file = gr.File(file_count='single', file_types=[".mp3"], label="Audio file")
|
353 |
+
sep_dropdown = gr.Dropdown(
|
354 |
+
["0 - spleeter (vocals, music)",
|
355 |
+
"1 - spleeter (vocals, drums, bass, other)",
|
356 |
+
"2 - spleeter (vocals, drums, bass, piano, other)",
|
357 |
+
"3 - unmix XL (vocals, drums, bass, other)",
|
358 |
+
"4 - unmix HQ (vocals, drums, bass, other)",
|
359 |
+
"5 - unmix SD (vocals, drums, bass, other)",
|
360 |
+
"6 - unmix SE (vocals, music)",
|
361 |
+
"7 - MDX A (vocals, drums, bass, other)",
|
362 |
+
"8 - MDX B (vocals, drums, bass, other)",
|
363 |
+
"9 - UVR HQ (vocals, music)",
|
364 |
+
"10 - Demucs3 Model A (vocals, drums, bass, other)",
|
365 |
+
"11 - Demucs3 Model B (vocals, drums, bass, other)",
|
366 |
+
"12 - MDX-B Karaoke (lead/back vocals)",
|
367 |
+
"13 - Demucs2 (vocals, drums, bass, other)",
|
368 |
+
"14 - Zero Shot (Query Based) (LQ)",
|
369 |
+
"15 - Danna sep (vocals, drums, bass, other)",
|
370 |
+
"16 - Byte Dance (vocals, drums, bass, other)",
|
371 |
+
"17 - UVRv5 Demucs (vocals, music)",
|
372 |
+
"18 - MVSep DNR (music, sfx, speech)",
|
373 |
+
"19 - MVSep Vocal Model (vocals, music)",
|
374 |
+
"20 - Demucs4 HT (vocals, drums, bass, other)",
|
375 |
+
"--------------------------------------------------------------------------------------------------",
|
376 |
+
"22 - FoxJoy Reverb Removal (other)",
|
377 |
+
"23 - MDX B (vocals, instrumental)",
|
378 |
+
"24 - MVSep Demucs4HT DNR (dialog, sfx, music)",
|
379 |
+
"25 - MDX23C (vocals, instrumental)",
|
380 |
+
"26 - Ensemble (vocals, instrumental) [PREMIUM ONLY]",
|
381 |
+
"27 - Demucs4 Vocals 2023 (vocals, instrumental)",
|
382 |
+
"28 - Ensemble (vocals, instrumental, bass, drums, other) [PREMIUM ONLY]",
|
383 |
+
"29 - MVSep Piano (piano, other)",
|
384 |
+
"30 - Ensemble All-In (vocals, bass, drums, piano, guitar, lead/back vocals, other) [PREMIUM ONLY]",
|
385 |
+
"31 - MVSep Guitar (guitar, other)",
|
386 |
+
"-------------------------------------------------------------------------------------------------",
|
387 |
+
"33 - Vit Large 23 (vocals, instrum)",
|
388 |
+
"34 - MVSep Crowd removal (crowd, other)",
|
389 |
+
"35 - MVSep MelBand Roformer (vocals, instrum)",
|
390 |
+
"36 - BandIt Plus (speech, music, effects)",
|
391 |
+
"37 - DrumSep (kick, snare, cymbals, toms)",
|
392 |
+
"38 - LarsNet (kick, snare, cymbals, toms, hihat)",
|
393 |
+
"39 - Whisper (extract text from audio)",
|
394 |
+
"40 - BS Roformer (vocals, instrumental)",
|
395 |
+
"41 - MVSep Bass (bass, other)"],
|
396 |
+
max_choices=1,
|
397 |
+
value="11 - Demucs3 Model B (vocals, drums, bass, other)",
|
398 |
+
label="Model type:",
|
399 |
+
interactive=True,
|
400 |
+
type='index'
|
401 |
+
)
|
402 |
send_req = gr.Button("Send request", variant='primary')
|
|
|
403 |
send_req.click(
|
404 |
mvsep_api_request,
|
405 |
+
[mvsep_key, audio_file, sep_dropdown],
|
406 |
[gr.Text(label="Output")]
|
407 |
)
|
|
|
|
|
|
|
|
|
|
|
408 |
with gr.Tab("Get status of request"):
|
409 |
with gr.Row():
|
410 |
with gr.Column():
|
|
|
424 |
)
|
425 |
|
426 |
with gr.TabItem("Changelog"):
|
427 |
+
gr.Markdown("v0.99.5 - Added bug fixes and Dropdown instead of button for MVSEP.")
|
428 |
gr.Markdown("v0.99.4 - Added a button to display the available models for MVSEP.")
|
429 |
gr.Markdown("v0.99.3 - Added MVSEP in Misc Tools. This is VERY EXPERIMENTAL and there will be bugs present.")
|
|
|
|
|
|
|
|
|
430 |
|
431 |
app.launch()
|