How do I return an image in fastAPI?
If you already have the bytes of the image in memory Return a fastapi.responses.Response with your custom content and media_type. You’ll also need to muck with the endpoint decorator to get FastAPI to put the correct media type in the OpenAPI specification. @app.get( “/image”, # Set what the media type will be in the autogenerated … Read more