Hev832 commited on
Commit
6a520e3
·
verified ·
1 Parent(s): 9e0d0d0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -12
app.py CHANGED
@@ -143,8 +143,8 @@ 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}/split_{i}.wav', chunk, sr)
147
- return f"dataset/{audio_name}/"
148
 
149
  # Function to zip the dataset directory
150
  def zip_directory(directory_path, audio_name):
@@ -180,14 +180,20 @@ with gr.Blocks() as demo:
180
  with gr.Tabs():
181
  with gr.TabItem("make dataset"):
182
  with gr.Row():
183
- url_input = gr.Textbox(label="YouTube URL")
184
- audio_name_input = gr.Textbox(label="Audio Name")
185
- hf_token_input = gr.Textbox(label="Hugging Face Token", type="password")
186
- repo_id_input = gr.Textbox(label="Repository ID")
187
- result_output = gr.File(label="Download Sliced Audio Zip")
188
- upload_output = gr.Textbox(label="Hugging Face Upload Status")
189
-
190
- run_button = gr.Button("Download and Slice Audio")
191
- run_button.click(fn=process_audio, inputs=[url_input, audio_name_input, hf_token_input, repo_id_input], outputs=[result_output, upload_output])
192
-
 
 
 
 
 
 
193
  demo.launch()
 
143
  for i, chunk in enumerate(chunks):
144
  if len(chunk.shape) > 1:
145
  chunk = chunk.T
146
+ sf.write(f'dataset/{audio_name}/{audio_name}/split_{i}.wav', chunk, sr)
147
+ return f"dataset/{audio_name}"
148
 
149
  # Function to zip the dataset directory
150
  def zip_directory(directory_path, audio_name):
 
180
  with gr.Tabs():
181
  with gr.TabItem("make dataset"):
182
  with gr.Row():
183
+ url_input = gr.Textbox(label="YouTube URL")
184
+ audio_name_input = gr.Textbox(label="Audio Name")
185
+ with gr.Row():
186
+ with gr.Accordion("Export dataset to huggingface"):
187
+ with gr.Row():
188
+ hf_token_input = gr.Textbox(label="Hugging Face Token", type="password")
189
+ repo_id_input = gr.Textbox(label="Repository ID")
190
+ upload_output = gr.Textbox(label="Hugging Face Upload Status")
191
+ with gr.Row():
192
+ result_output = gr.File(label="Download Sliced Audio Zip")
193
+ with gr.Row():
194
+ run_button = gr.Button("Download and Slice Audio")
195
+ run_button.click(fn=process_audio, inputs=[url_input, audio_name_input, hf_token_input, repo_id_input], outputs=[result_output, upload_output])
196
+
197
+
198
+
199
  demo.launch()