Kryptone commited on
Commit
82d61fb
·
verified ·
1 Parent(s): 12ce065

new update, check changelog tab

Browse files
Files changed (1) hide show
  1. app.py +103 -7
app.py CHANGED
@@ -214,7 +214,7 @@ def mvsep_api_request(mvsep_key, audio_file, sep_dropdown):
214
  r = requests.post(url, files=files, data=data)
215
  json_format = r.json()
216
  hash_val = json_format['data']['hash']
217
- return f"Request sent successfully! Your hash is: {hash_val}.\n\nUse the next tab to check the status of your request."
218
 
219
  def mvsep_check_request(hash_textbox):
220
  try:
@@ -246,11 +246,45 @@ def mvsep_download_separated_audio(hash_textbox):
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 Cafeteria! (formally GDMGS)</h1>"
254
  )
255
  gr.Markdown("## Duplicate this space if you want to make your own changes!")
256
  gr.HTML(
@@ -259,10 +293,10 @@ with gr.Blocks(theme='sudeepshouche/minimalist', title="Global Dataset Maker") a
259
  </p>"""
260
  )
261
  gr.Markdown(
262
- "This Space will create a dataset for you and use MVSEP to isolate vocals (EXPERIMENTAL), all automatically. **Please be warned that due to not having a GPU on this Space, some steps might take longer to complete.**"
263
  )
264
  gr.HTML(
265
- "<h2> This Space's storage is ephemeral, meaning once you reload this space, all audio files will be lost. </h2>"
266
  )
267
  with gr.Tabs():
268
  with gr.TabItem("Download Video"):
@@ -343,8 +377,8 @@ with gr.Blocks(theme='sudeepshouche/minimalist', title="Global Dataset Maker") a
343
  None
344
  )
345
  with gr.Tab("MVSEP"):
346
- gr.Markdown("**VERY EXPERIMENTAL!** Use MVSEP to isolate audio.\n\n**You will be required to input your API key, but it will not be saved ever, I don't use anything saved here for bad intentions, nor would I have access to it regardless.**")
347
- with gr.Tab("Send Request"):
348
  with gr.Row():
349
  with gr.Column():
350
  with gr.Row():
@@ -405,6 +439,67 @@ with gr.Blocks(theme='sudeepshouche/minimalist', title="Global Dataset Maker") a
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,8 +519,9 @@ with gr.Blocks(theme='sudeepshouche/minimalist', title="Global Dataset Maker") a
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()
 
214
  r = requests.post(url, files=files, data=data)
215
  json_format = r.json()
216
  hash_val = json_format['data']['hash']
217
+ return f"Request sent successfully! Your hash is: {hash_val}\n\nUse the 'Get Status' tab to check the status of your request."
218
 
219
  def mvsep_check_request(hash_textbox):
220
  try:
 
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
+ def mvsep_yt_link_request(mvsep_key2, sep_dropdown2, yt_link):
251
+ try:
252
+ yt = YouTube(yt_link)
253
+ except pytube.exceptions.RegexMatchError:
254
+ raise gr.Error("URL not valid or is empty! Please fix the link or enter one!")
255
+ except urllib.error.HTTPError as not_ok:
256
+ raise gr.Error(f"Recieved {not_ok}")
257
+ except pytube.exceptions.AgeRestrictedError:
258
+ raise gr.Error("The video you inputted is age-restricted! Please try another link.")
259
+ video = yt.streams.get_highest_resolution()
260
+ video.download()
261
+ video_path = f"{video.default_filename}"
262
+ video_clip = VideoFileClip(video_path)
263
+ audio_clip = video_clip.audio
264
+ audio_clip.write_audiofile("output.mp3")
265
+ audio_clip.close()
266
+ video_clip.close()
267
+ for removalmp4 in glob.glob("*.mp4"):
268
+ os.remove(removalmp4)
269
+
270
+ url = "https://mvsep.com/api/separation/create"
271
+ files = {
272
+ "audiofile": open("output.mp3", 'rb')
273
+ }
274
+ data = {
275
+ "api_token": mvsep_key2,
276
+ "sep_type": sep_dropdown2
277
+ }
278
+ r = requests.post(url, files=files, data=data)
279
+ json_format = r.json()
280
+ hash_val = json_format['data']['hash']
281
+ return f"Request sent successfully! Your hash is: {hash_val}\n\nUse the next tab to check the status of your request."
282
+
283
 
284
 
285
  with gr.Blocks(theme='sudeepshouche/minimalist', title="Global Dataset Maker") as app:
286
  gr.HTML(
287
+ "<h1> Welcome to the Cafeteria (formally GDMGS)!</h1>"
288
  )
289
  gr.Markdown("## Duplicate this space if you want to make your own changes!")
290
  gr.HTML(
 
293
  </p>"""
294
  )
295
  gr.Markdown(
296
+ "This Space will create a dataset for you and use MVSEP to isolate vocals, all automatically. **Please be warned that due to not having a GPU on this Space, some steps might take longer to complete.**"
297
  )
298
  gr.HTML(
299
+ "<h2> This Space's storage is ephemeral, meaning all audio files are visible to you only. I do not have access to any of this, nor would I do anything with it anyway. </h2>"
300
  )
301
  with gr.Tabs():
302
  with gr.TabItem("Download Video"):
 
377
  None
378
  )
379
  with gr.Tab("MVSEP"):
380
+ gr.Markdown("Use MVSEP to isolate audio.\n\n**You will be required to input your API key, but it will not be saved ever, I don't use anything saved here for bad intentions, nor would I have access to it regardless.**")
381
+ with gr.Tab("Send Request via audio file"):
382
  with gr.Row():
383
  with gr.Column():
384
  with gr.Row():
 
439
  [mvsep_key, audio_file, sep_dropdown],
440
  [gr.Text(label="Output")]
441
  )
442
+ with gr.Tab("Send Request via yt link"):
443
+ with gr.Row():
444
+ with gr.Column():
445
+ with gr.Row():
446
+ mvsep_key2 = gr.Textbox(placeholder="Enter your MVSEP API key.", label="API key")
447
+ yt_link = gr.Textbox(label="YouTube link")
448
+ sep_dropdown2 = gr.Dropdown(
449
+ ["0 - spleeter (vocals, music)",
450
+ "1 - spleeter (vocals, drums, bass, other)",
451
+ "2 - spleeter (vocals, drums, bass, piano, other)",
452
+ "3 - unmix XL (vocals, drums, bass, other)",
453
+ "4 - unmix HQ (vocals, drums, bass, other)",
454
+ "5 - unmix SD (vocals, drums, bass, other)",
455
+ "6 - unmix SE (vocals, music)",
456
+ "7 - MDX A (vocals, drums, bass, other)",
457
+ "8 - MDX B (vocals, drums, bass, other)",
458
+ "9 - UVR HQ (vocals, music)",
459
+ "10 - Demucs3 Model A (vocals, drums, bass, other)",
460
+ "11 - Demucs3 Model B (vocals, drums, bass, other)",
461
+ "12 - MDX-B Karaoke (lead/back vocals)",
462
+ "13 - Demucs2 (vocals, drums, bass, other)",
463
+ "14 - Zero Shot (Query Based) (LQ)",
464
+ "15 - Danna sep (vocals, drums, bass, other)",
465
+ "16 - Byte Dance (vocals, drums, bass, other)",
466
+ "17 - UVRv5 Demucs (vocals, music)",
467
+ "18 - MVSep DNR (music, sfx, speech)",
468
+ "19 - MVSep Vocal Model (vocals, music)",
469
+ "20 - Demucs4 HT (vocals, drums, bass, other)",
470
+ "--------------------------------------------------------------------------------------------------",
471
+ "22 - FoxJoy Reverb Removal (other)",
472
+ "23 - MDX B (vocals, instrumental)",
473
+ "24 - MVSep Demucs4HT DNR (dialog, sfx, music)",
474
+ "25 - MDX23C (vocals, instrumental)",
475
+ "26 - Ensemble (vocals, instrumental) [PREMIUM ONLY]",
476
+ "27 - Demucs4 Vocals 2023 (vocals, instrumental)",
477
+ "28 - Ensemble (vocals, instrumental, bass, drums, other) [PREMIUM ONLY]",
478
+ "29 - MVSep Piano (piano, other)",
479
+ "30 - Ensemble All-In (vocals, bass, drums, piano, guitar, lead/back vocals, other) [PREMIUM ONLY]",
480
+ "31 - MVSep Guitar (guitar, other)",
481
+ "-------------------------------------------------------------------------------------------------",
482
+ "33 - Vit Large 23 (vocals, instrum)",
483
+ "34 - MVSep Crowd removal (crowd, other)",
484
+ "35 - MVSep MelBand Roformer (vocals, instrum)",
485
+ "36 - BandIt Plus (speech, music, effects)",
486
+ "37 - DrumSep (kick, snare, cymbals, toms)",
487
+ "38 - LarsNet (kick, snare, cymbals, toms, hihat)",
488
+ "39 - Whisper (extract text from audio)",
489
+ "40 - BS Roformer (vocals, instrumental)",
490
+ "41 - MVSep Bass (bass, other)"],
491
+ max_choices=1,
492
+ value="11 - Demucs3 Model B (vocals, drums, bass, other)",
493
+ label="Model type:",
494
+ interactive=True,
495
+ type='index'
496
+ )
497
+ send_req2 = gr.Button("Send request", variant='primary')
498
+ send_req2.click(
499
+ mvsep_yt_link_request,
500
+ [mvsep_key2, sep_dropdown2, yt_link],
501
+ [gr.Text(label="Output")]
502
+ )
503
  with gr.Tab("Get status of request"):
504
  with gr.Row():
505
  with gr.Column():
 
519
  )
520
 
521
  with gr.TabItem("Changelog"):
522
+ gr.Markdown("v0.99.6 - Added a yt link request method for MVSEP.")
523
  gr.Markdown("v0.99.5 - Added bug fixes and Dropdown instead of button for MVSEP.")
524
  gr.Markdown("v0.99.4 - Added a button to display the available models for MVSEP.")
525
+ gr.Markdown("v0.99.3 - Added MVSEP in Misc Tools.")
526
 
527
  app.launch()