Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -174,9 +174,14 @@ def process_audio(url, audio_name, hf_token, repo_id):
|
|
174 |
dataset_path = slice_audio(file_path, audio_name)
|
175 |
zip_file = zip_directory(dataset_path, audio_name)
|
176 |
upload_message = upload_to_huggingface(zip_file, repo_id, hf_token)
|
177 |
-
return zip_file
|
178 |
-
|
179 |
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
# create new repository (optional)
|
181 |
def create_new_repo(repoid):
|
182 |
try:
|
@@ -204,9 +209,7 @@ with gr.Blocks() as demo:
|
|
204 |
with gr.Row():
|
205 |
run_button = gr.Button("Download and Slice Audio")
|
206 |
run_button.click(fn=process_audio, inputs=[url_input, audio_name_input], outputs=[result_output])
|
207 |
-
|
208 |
-
|
209 |
-
push_hub.click(fn=process_audio, inputs=[result_output, hf_token_input, repo_id_input], outputs=[upload_output])
|
210 |
|
211 |
|
212 |
demo.launch()
|
|
|
174 |
dataset_path = slice_audio(file_path, audio_name)
|
175 |
zip_file = zip_directory(dataset_path, audio_name)
|
176 |
upload_message = upload_to_huggingface(zip_file, repo_id, hf_token)
|
177 |
+
return zip_file
|
|
|
178 |
|
179 |
+
# upload to hf
|
180 |
+
def push_to_hub(hf_token, repo_id):
|
181 |
+
zip_file = zip_directory(dataset_path, audio_name)
|
182 |
+
upload_message = upload_to_huggingface(zip_file, repo_id, hf_token)
|
183 |
+
return upload_message
|
184 |
+
|
185 |
# create new repository (optional)
|
186 |
def create_new_repo(repoid):
|
187 |
try:
|
|
|
209 |
with gr.Row():
|
210 |
run_button = gr.Button("Download and Slice Audio")
|
211 |
run_button.click(fn=process_audio, inputs=[url_input, audio_name_input], outputs=[result_output])
|
212 |
+
push_hub.click(fn=push_to_hub, inputs=[result_output, hf_token_input, repo_id_input], outputs=[upload_output])
|
|
|
|
|
213 |
|
214 |
|
215 |
demo.launch()
|