stardate69 commited on
Commit
7fea2c3
·
verified ·
1 Parent(s): a85e7a0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -55,8 +55,10 @@ def generate_audio():
55
  output_path = os.path.join(OUTPUT_PATH, output_filename)
56
  sf.write(output_path, output_audio, pipe.vae.sampling_rate)
57
 
58
- # Send the file for download
59
- return send_file(output_path, as_attachment=True)
 
 
60
 
61
  # Return the WAV file
62
  #return jsonify({"file_path": absolute_output_path}), 200
 
55
  output_path = os.path.join(OUTPUT_PATH, output_filename)
56
  sf.write(output_path, output_audio, pipe.vae.sampling_rate)
57
 
58
+ if os.path.exists(output_path):
59
+ return send_file(output_path, as_attachment=True)
60
+ else:
61
+ return {"error": f"File not found at {output_path}"}, 404
62
 
63
  # Return the WAV file
64
  #return jsonify({"file_path": absolute_output_path}), 200