(file: UploadFile = File(...))
| 26 | |
| 27 | @app.post("/resnext") |
| 28 | def process_resnext(file: UploadFile = File(...)): |
| 29 | file_bytes = file.file.read() |
| 30 | image = Image.open(io.BytesIO(file_bytes)) |
| 31 | name = f"/data/{str(uuid.uuid4())}.jpg" |
| 32 | image.save(name) |
| 33 | predictions = resnext(image) |
| 34 | return predictions |
| 35 | # return Response(content=json.dumps(predictions), media_type="application/json") |
| 36 | # return Response(file_bytes, media_type="image/jpg") |
| 37 | |
| 38 | |
| 39 | @app.get("/pgan") |