add info on /
This commit is contained in:
parent
3d92973fab
commit
71a17f4252
1 changed files with 6 additions and 0 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue