From 5561fba9f86ceb38de8c8a560cfee547fab068d1 Mon Sep 17 00:00:00 2001 From: Kye Date: Tue, 16 Apr 2024 16:50:58 -0400 Subject: [PATCH] [LOG] --- servers/text_to_video/sample_curl.sh | 0 text_to_video.py | 20 ++++++++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) mode change 100644 => 100755 servers/text_to_video/sample_curl.sh diff --git a/servers/text_to_video/sample_curl.sh b/servers/text_to_video/sample_curl.sh old mode 100644 new mode 100755 diff --git a/text_to_video.py b/text_to_video.py index 25d5566..17e210c 100644 --- a/text_to_video.py +++ b/text_to_video.py @@ -14,8 +14,7 @@ from huggingface_hub import hf_hub_download from loguru import logger from safetensors.torch import load_file -from fastapi.responses import FileResponse - +from fastapi.responses import FileResponse, JSONResponse from swarms_cloud.schema.text_to_video import TextToVideoRequest, TextToVideoResponse # Load environment variables from .env file @@ -132,23 +131,24 @@ async def create_chat_completion( # logger.error(f"Error: {e}") # raise HTTPException(status_code=500, detail="Internal Server Error") - # out = TextToVideoResponse( - # status="success", - # request_details=request, - # video_url=response, - # error=None, - # ) + log = TextToVideoResponse( + status="success", + request_details=request, + video_url=response, + error=None, + ) # logger.info(f"Response: {out}") logger.info(f"Downloading the file: {response}") - out = FileResponse( + + FileResponse( path=response, filename=request.output_path, media_type="image/gif", # Use the correct media type for GIFs headers={"Content-Disposition": "attachment; filename=" + request.output_path}, ) - return out + return JSONResponse(content=log.dict(), status_code=200) except Exception as e: logger.error(f"Error: {e}") raise HTTPException(status_code=500, detail="Internal Server Error")