Move inference onto the API

This commit is contained in:
2026-01-05 16:54:25 +01:00
parent e457fc6be8
commit 9e0d586f6a
15 changed files with 55 additions and 48 deletions

View File

@@ -23,13 +23,13 @@ class Camera:
self.cap.release()
self.cap = None
def take_photo(self) -> np.ndarray:
def take_photo(self) -> bytes:
self.open()
try:
ret, frame = self.cap.read()
if not ret:
raise RuntimeError("Failed to capture image")
return frame
return cv2.imencode('.jpg', frame, [int(cv2.IMWRITE_JPEG_QUALITY), 80])[1].tobytes()
finally:
self.close()