File size: 460 Bytes
7d51abb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from fastapi import FastAPI, File
from io import BytesIO
from PIL import Image
from predict import read_image, transformacao

app = FastAPI()

@app.get("/")
async def root():
    return {"message": "Idiot, you are in the wrong place!"}

@app.post("/uploadfile/")
async def create_upload_file(file: bytes = File(...)):

    # read image
    imagem = read_image(file)
    # transform and prediction 
    prediction = transformacao(imagem)

    return prediction