Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -143,7 +143,7 @@ def slice_audio(file_path, audio_name):
|
|
143 |
for i, chunk in enumerate(chunks):
|
144 |
if len(chunk.shape) > 1:
|
145 |
chunk = chunk.T
|
146 |
-
sf.write(f'dataset/{audio_name}/
|
147 |
return f"dataset/{audio_name}"
|
148 |
|
149 |
# Function to zip the dataset directory
|
@@ -193,16 +193,18 @@ with gr.Blocks() as demo:
|
|
193 |
url_input = gr.Textbox(label="YouTube URL")
|
194 |
audio_name_input = gr.Textbox(label="Audio Name")
|
195 |
with gr.Row():
|
196 |
-
with gr.Accordion("Export dataset to huggingface"):
|
197 |
with gr.Row():
|
198 |
-
hf_token_input = gr.Textbox(label="Hugging Face Token"
|
199 |
repo_id_input = gr.Textbox(label="Repository ID")
|
|
|
|
|
200 |
upload_output = gr.Textbox(label="Hugging Face Upload Status")
|
201 |
with gr.Row():
|
202 |
result_output = gr.File(label="Download Sliced Audio Zip")
|
203 |
with gr.Row():
|
204 |
run_button = gr.Button("Download and Slice Audio")
|
205 |
-
run_button.click(fn=process_audio, inputs=[url_input, audio_name_input, hf_token_input, repo_id_input], outputs=[result_output
|
206 |
|
207 |
|
208 |
|
|
|
143 |
for i, chunk in enumerate(chunks):
|
144 |
if len(chunk.shape) > 1:
|
145 |
chunk = chunk.T
|
146 |
+
sf.write(f'dataset/{audio_name}/split_{i}.wav', chunk, sr)
|
147 |
return f"dataset/{audio_name}"
|
148 |
|
149 |
# Function to zip the dataset directory
|
|
|
193 |
url_input = gr.Textbox(label="YouTube URL")
|
194 |
audio_name_input = gr.Textbox(label="Audio Name")
|
195 |
with gr.Row():
|
196 |
+
with gr.Accordion("Export dataset to huggingface", open=False):
|
197 |
with gr.Row():
|
198 |
+
hf_token_input = gr.Textbox(label="Hugging Face Token")
|
199 |
repo_id_input = gr.Textbox(label="Repository ID")
|
200 |
+
push_hub = gr.Button(label="Hugging Face Upload Status")
|
201 |
+
push_hub.click(fn=process_audio, inputs=[result_output, hf_token_input, repo_id_input], outputs=[upload_output])
|
202 |
upload_output = gr.Textbox(label="Hugging Face Upload Status")
|
203 |
with gr.Row():
|
204 |
result_output = gr.File(label="Download Sliced Audio Zip")
|
205 |
with gr.Row():
|
206 |
run_button = gr.Button("Download and Slice Audio")
|
207 |
+
run_button.click(fn=process_audio, inputs=[url_input, audio_name_input, hf_token_input, repo_id_input], outputs=[result_output])
|
208 |
|
209 |
|
210 |
|