Skip to content
Discussion options

You must be logged in to vote

I've managed using:

@app.get(
    "/pm25/",
    response_model=Item,
    responses={
        200: {
            "content": {"image/gif": {}},
            "description": "Return the JSON item or an image.",
        }
    },
)
async def read_item():
    filepath = "/home/ludo915/code/covsco/forecast/fr/PM2.5-concentration-" +date +".gif"
    return FileResponse(filepath, media_type="image/gif")

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Kludex
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question or problem question-migrate
2 participants
Converted from issue

This discussion was converted from issue #3158 on February 27, 2023 23:02.