fix: remove mp3 data

This commit is contained in:
Dan Chen
2024-03-18 17:33:08 +08:00
parent 8513270e9e
commit 11990d47db
3 changed files with 2 additions and 2 deletions

BIN
audio.mp3

Binary file not shown.

View File

@ -1,5 +1,5 @@
from fastapi import Response, status
from fastapi.responses import FileResponse, JSONResponse
from fastapi.responses import JSONResponse
from blackbox.blackbox import Blackbox
from gtts import gTTS
from io import BytesIO
@ -26,4 +26,4 @@ class TextToAudio(Blackbox):
if text is None:
return JSONResponse(content={"error": "text is required"}, status_code=status.HTTP_400_BAD_REQUEST)
by = self.processing(text)
return Response(content=by.read(), media_type="audio/mpeg", headers={"Content-Disposition": "attachment; filename=audio.mp3"})
return Response(content=by.read(), media_type="audio/mp3", headers={"Content-Disposition": "attachment; filename=audio.mp3"})

View File