diablofx commited on
Commit
0e5c9f0
1 Parent(s): ce0b765

Update audio_processor.py

Browse files
Files changed (1) hide show
  1. 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 = tempfile.mkdtemp()
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="/download/{os.path.basename(zip_file_path)}" download>Click here to download</a>'
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