Spaces:
Sleeping
Sleeping
Update app.py
Browse files157 unmodified lines1581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931943 unmodified lines198199200201202203204205206207208209210211212213214215216217218219220221222223224157 unmodified lineszipf.write(file_path, arcname)return zip_file# Function to upload zip file to Hugging Face Hubdef upload_to_huggingface(zip_file, repo_id, hf_token):api = HfApi()api.upload_file(path_or_fileobj=zip_file,path_in_repo=os.path.basename(zip_file),repo_id=repo_id,token=hf_token)return f"File uploaded to {repo_id}/{os.path.basename(zip_file)}"# Gradio interfacedef process_audio(url, audio_name):file_path = download_youtube_audio(url, audio_name)dataset_path = slice_audio(file_path, audio_name)zip_file = zip_directory(dataset_path, audio_name)return zip_file# upload to hfdef push_to_hub(hf_token, repo_id):zip_file = zip_directory(dataset_path, audio_name)upload_message = upload_to_huggingface(zip_file, repo_id, hf_token)return upload_message# create new repository (optional)def create_new_repo(repoid):try:create_repo(repoid)return f"Repo '{repoid}' created successfully!"except Exception as e:return str(e)negra = gr.themes.Base(3 unmodified lineswith gr.Blocks(theme=negra) as demo:gr.Markdown("# <div style='text-align: center;'> RVC DATASET MAKER</div>")gr.Markdown(" <div style='text-align: center;'> only work for audio only vocal!</div>")with gr.Tabs():with gr.TabItem("make dataset"):with gr.Row():url_input = gr.Textbox(label="YouTube URL", placeholder="https://youtu.be/ZdoiTX1f1tU?si=hZ96tryqaPIYfwg1")with gr.Row():audio_name_input = gr.Textbox(label="Audio Name", placeholder="Amy")with gr.Row():with gr.Accordion("Export dataset to huggingface (optional)", visible=False):with gr.Row():hf_token_input = gr.Textbox(label="Hugging Face Token")repo_id_input = gr.Textbox(label="Repository ID")with gr.Row():push_hub = gr.Button("Hugging Face Upload")upload_output = gr.Textbox(label="Hugging Face Upload Status")with gr.Row():result_output = gr.File(label="Download Sliced Audio Zip")with gr.Row():run_button = gr.Button("Slice 👾 Audio")run_button.click(fn=process_audio, inputs=[url_input, audio_name_input], outputs=[result_output])push_hub.click(fn=push_to_hub, inputs=[result_output, hf_token_input, repo_id_input], outputs=[upload_output])with gr.TabItem("note"):with gr.Row():gr.Markdown(157 unmodified lines1581591601611621631641651661671681691701711723 unmodified lines176177178179180181182183184185186187188189190191192193194157 unmodified lineszipf.write(file_path, arcname)return zip_file# Gradio interfacedef process_audio(url, audio_name):file_path = download_youtube_audio(url, audio_name)dataset_path = slice_audio(file_path, audio_name)zip_file = zip_directory(dataset_path, audio_name)return zip_file, print(f"{zip_file} successfully processed")negra = gr.themes.Base(3 unmodified lineswith gr.Blocks(theme=negra) as demo:gr.Markdown("# <div style='text-align: center;'> RVC DATASET MAKER</div>")gr.Markdown(" <div style='text-align: center;'> only work for vocal only audio!</div>")with gr.Tabs():with gr.TabItem("make dataset"):with gr.Row():url_input = gr.Textbox(label="YouTube URL", placeholder="https://youtu.be/ZdoiTX1f1tU?si=hZ96tryqaPIYfwg1")with gr.Row():audio_name_input = gr.Textbox(label="Audio Name", placeholder="Amy")with gr.Row():result_output = gr.File(label="Download Sliced Audio Zip")result_process = gr.Textbox(label="Sliced Audio output")with gr.Row():run_button = gr.Button("Slice 👾 Audio")run_button.click(fn=process_audio, inputs=[url_input, audio_name_input], outputs=[result_output, result_process])with gr.TabItem("note"):with gr.Row():gr.Markdown(
app.py+5-35