I need to upload multiple image files via FastApi. I am using this code:
@app.post("/analyze")
async def analyze(files: List[UploadFile] = File(...)):
for img in files:
contents = await img.read()
nparr = np.fromstring(contents, np.uint8)
img1 = cv2.imdecode(nparr, cv2.IMREAD_COLOR)
print(img1.shape)
img1 = resize_image(img1)
print(img1.shape)
But it is showing error as:
NameError: name 'List' is not defined
Please help!
I would try to upload multiple images via fastapi and then perform opencv operations on it. Also where to upload image if I am using Postman instead for SwaggerUI for testing?