Spaces:
Runtime error
Runtime error
Update audio_processor.py
Browse files- audio_processor.py +6 -2
audio_processor.py
CHANGED
@@ -27,13 +27,17 @@ def process_audio(audio, interval):
|
|
27 |
interval = int(interval)
|
28 |
|
29 |
# Temporary directory to store the processed files
|
30 |
-
temp_output_dir =
|
31 |
|
32 |
# Process the audio file and get the path to the zip file
|
33 |
zip_file_path = cut_audio(audio.name, temp_output_dir, interval)
|
34 |
|
|
|
|
|
|
|
|
|
35 |
# Create a download link
|
36 |
-
download_link = f'<a href="
|
37 |
|
38 |
# Return the download link as HTML
|
39 |
return download_link
|
|
|
27 |
interval = int(interval)
|
28 |
|
29 |
# Temporary directory to store the processed files
|
30 |
+
temp_output_dir = '/content' # This is writable in Hugging Face Spaces
|
31 |
|
32 |
# Process the audio file and get the path to the zip file
|
33 |
zip_file_path = cut_audio(audio.name, temp_output_dir, interval)
|
34 |
|
35 |
+
# Move the zip file to a publicly accessible location
|
36 |
+
public_zip_path = f'/content/{os.path.basename(zip_file_path)}'
|
37 |
+
os.rename(zip_file_path, public_zip_path)
|
38 |
+
|
39 |
# Create a download link
|
40 |
+
download_link = f'<a href="{public_zip_path}" download>Click here to download</a>'
|
41 |
|
42 |
# Return the download link as HTML
|
43 |
return download_link
|