MCPcopy Create free account
hub / github.com/alpha2phi/python-apps / process_yolov5

Function process_yolov5

ml-yolo/backend/main.py:67–79  ·  view source on GitHub ↗
(file: UploadFile = File(...))

Source from the content-addressed store, hash-verified

65
66@app.post("/yolo")
67def process_yolov5(file: UploadFile = File(...)):
68 file_bytes = file.file.read()
69 image = Image.open(io.BytesIO(file_bytes))
70 name = f"/data/{str(uuid.uuid4())}.png"
71
72 # image.save(name)
73 image.filename = name
74 classes, converted_img = yolov5(image)
75
76 bytes_io = io.BytesIO()
77 converted_img.save(name)
78 converted_img.save(bytes_io, format="PNG")
79 return Response(bytes_io.getvalue(), media_type="image/png")
80
81
82@app.websocket("/yolo_ws/{client_id}")

Callers

nothing calls this directly

Calls 1

yolov5Function · 0.90

Tested by

no test coverage detected