Skip to content

Commit

Permalink
fix: remove code unecessary code block
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldotyu committed May 3, 2024
1 parent e1ede52 commit 7e0bd6d
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/ai-service/routers/image_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,10 @@ async def post_image(request: Request) -> JSONResponse:
)

json_response = json.loads(result.model_dump_json())

if "error" in str(json_response).lower():
return Response(content=str(json_response), status_code=status.HTTP_401_UNAUTHORIZED)
print(json_response)

# Return the image as a JSON response
return JSONResponse(content={"image": json_response["data"][0]["url"]}, status_code=status.HTTP_200_OK)
except Exception as e:
# Return an error message as a JSON response
return JSONResponse(content={"error": str(e)}, status_code=status.HTTP_400_BAD_REQUEST)
return JSONResponse(content={"error": str(e)}, status_code=status.HTTP_500_INTERNAL_SERVER_ERROR)

0 comments on commit 7e0bd6d

Please sign in to comment.