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