| # model.py | |
| import cv2 | |
| import numpy as np | |
| def predict_mask(image: np.ndarray) -> np.ndarray: | |
| """ | |
| Simple vessel segmentation (safe fallback). | |
| Replace later with UNet once weights match. | |
| """ | |
| gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) | |
| blur = cv2.GaussianBlur(gray, (5, 5), 0) | |
| _, mask = cv2.threshold( | |
| blur, 0, 255, | |
| cv2.THRESH_BINARY + cv2.THRESH_OTSU | |
| ) | |
| return mask | |