Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -47,12 +47,12 @@ async def generate_audio(
|
|
47 |
)
|
48 |
print(output_file)
|
49 |
# Return the generated audio file as a response
|
50 |
-
return FileResponse(output_file, media_type="audio/wav"
|
51 |
|
52 |
except Exception as e:
|
53 |
raise HTTPException(status_code=500, detail=f"Error generating audio: {str(e)}")
|
54 |
|
55 |
-
finally:
|
56 |
-
|
57 |
-
|
58 |
-
|
|
|
47 |
)
|
48 |
print(output_file)
|
49 |
# Return the generated audio file as a response
|
50 |
+
return FileResponse(output_file, media_type="audio/wav")
|
51 |
|
52 |
except Exception as e:
|
53 |
raise HTTPException(status_code=500, detail=f"Error generating audio: {str(e)}")
|
54 |
|
55 |
+
# finally:
|
56 |
+
# # Clean up the generated file after the response is sent
|
57 |
+
# if os.path.exists(output_file):
|
58 |
+
# os.remove(output_file)
|