Skip to content

Commit

Permalink
[LOG]
Browse files Browse the repository at this point in the history
  • Loading branch information
Kye committed Apr 16, 2024
1 parent 4805199 commit 5561fba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Empty file modified servers/text_to_video/sample_curl.sh
100644 → 100755
Empty file.
20 changes: 10 additions & 10 deletions text_to_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 5561fba

Please sign in to comment.