@app.post("/predict/")
async def predict(file:UploadFile = File(...)):
bytes_str = io.BytesIO(await file.read())
img = Image.open(bytes_str)
img_array = np.array(img.convert('RGB'))
img_array = cv2.resize(img_array, (1024,1024))
img_final = np.expand_dims(img_array, axis = 0)
pred = model.predict(img_final)
This code returns a NumPy array and I need to return it on FastAPI on an endpoint, but what could be the strategy?