add info on /

This commit is contained in:
magmaus3 2023-06-29 21:20:12 +02:00
parent 3d92973fab
commit 71a17f4252
Signed by: magmaus3
GPG key ID: 966755D3F4A9B251

View file

@ -1,6 +1,8 @@
import fastapi
from PIL import Image, ImageDraw, ImageFont
from io import BytesIO
from fastapi.responses import PlainTextResponse
app = fastapi.FastAPI()
img = Image.open("./smoking-caterpillar.jpg")
@ -9,6 +11,10 @@ font = ImageFont.truetype("./unicode.impact.ttf", 72)
class JPEGResponse(fastapi.Response):
media_type="image/jpeg"
@app.get("/", response_class=PlainTextResponse)
async def root():
return "go to /image for the funny thingy"
@app.get("/img", response_class=JPEGResponse)
async def getImage(request: fastapi.Request):
img2 = img.copy()