add mvsep
Browse files12345678186 unmodified lines1951961971981992006 unmodified lines20720820921021121221376 unmodified lines290291292293294295296297import gradio as gr, glob, os, auditok, zipfile, wave, pytube.exceptions, urllib.errorfrom pytube import YouTubefrom moviepy.editor import *import traceback, yt_dlpdef download_video(url, download_as, use_ytdlp):if use_ytdlp == True:try:186 unmodified linesos.remove(w)return gr.Info("File removed.")with gr.Blocks(theme='sudeepshouche/minimalist', title="Global Dataset Maker") as app:gr.HTML(6 unmodified lines</p>""")gr.Markdown("This Space will create a dataset for you, all automatically. **Please be warned that due to not having a GPU on this Space, some steps might take longer to complete.**")gr.HTML("<h2> This Space's storage is ephemeral, meaning once you reload this space, all audio files will be lost. </h2>"76 unmodified linesNone,None)with gr.TabItem("Changelog"):gr.Markdown("v0.99.2 - Added an mp4 file converter.")gr.Markdown("v0.99.1 - Removed very old tools (including the 'Upcoming Features' tab) that did not fit with the nature of the program.")gr.Markdown("v0.99 - Added 'Strict Duration' mode for the file splitter.")123456789186 unmodified lines1961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362376 unmodified lines24424524624724824925076 unmodified lines327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368import gradio as gr, glob, os, auditok, zipfile, wave, pytube.exceptions, urllib.error, requests, jsonfrom pytube import YouTubefrom moviepy.editor import *import traceback, yt_dlpdef download_video(url, download_as, use_ytdlp):if use_ytdlp == True:try:186 unmodified linesos.remove(w)return gr.Info("File removed.")def mvsep_api_request(mvsep_key, audio_file, sep_int):url = "https://mvsep.com/api/separation/create"files = {"audiofile": open(audio_file, 'rb')}data = {"api_token": mvsep_key,"sep_type": sep_int}r = requests.post(url, files=files, data=data)json_format = r.json()hash_val = json_format['data']['hash']return f"Request sent successfully! Your hash is: {hash_val}.\n\nUse the next tab to check the status of your request."def mvsep_check_request(hash_textbox):url = "https://mvsep.com/api/separation/get"params = {"hash": hash_textbox}r = requests.get(url, params=params)rjson = r.json()success = rjson['success']status = rjson['status']return f"Was successful? {str(success)}.\n Status: {status}."def mvsep_download_separated_audio(hash_textbox):url = "https://mvsep.com/api/separation/get"params = {"hash": hash_textbox}r = requests.get(url, params=params)rjson = r.json()files = rjson.get('data', {}).get('files', [])urls = [file['url'] for file in files]return json.dumps(urls, indent=4)with gr.Blocks(theme='sudeepshouche/minimalist', title="Global Dataset Maker") as app:gr.HTML(6 unmodified lines</p>""")gr.Markdown("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.**")gr.HTML("<h2> This Space's storage is ephemeral, meaning once you reload this space, all audio files will be lost. </h2>"76 unmodified linesNone,None)with gr.Tab("MVSEP"):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.**")with gr.Tab("Send Request"):with gr.Row():with gr.Column():with gr.Row():mvsep_key = gr.Textbox(placeholder="Enter your MVSEP API key.", label="API key")audio_file = gr.File(file_count='single', file_types=[".mp3"], label="Audio file")sep_int = gr.Number(11, label="Separation type (default is 11).", minimum=0, maximum=40, interactive=True)send_req = gr.Button("Send request", variant='primary')copy_hash = gr.Button("Copy hash to clipboard", variant='secondary')send_req.click(mvsep_api_request,[mvsep_key, audio_file, sep_int],[gr.Text(label="Output")])with gr.Tab("Get status of request"):with gr.Row():with gr.Column():with gr.Row():hash_textbox = gr.Textbox(label="Hash")check_status = gr.Button("Check status", variant='primary')download = gr.Button("Download separated audio", variant='secondary')check_status.click(mvsep_check_request,[hash_textbox],[gr.Text(label="Status")])download.click(mvsep_download_separated_audio,[hash_textbox],[gr.Text(label="Link(s)")])with gr.TabItem("Changelog"):gr.Markdown("v0.99.3 - Added MVSEP in Misc Tools. This is VERY EXPERIMENTAL and there will be bugs present.")gr.Markdown("v0.99.2 - Added an mp4 file converter.")gr.Markdown("v0.99.1 - Removed very old tools (including the 'Upcoming Features' tab) that did not fit with the nature of the program.")gr.Markdown("v0.99 - Added 'Strict Duration' mode for the file splitter.")
app.py+73-2