Spaces:
Runtime error
Runtime error
| from ocr.base import GeminiExtractor | |
| _PROMPT = """ | |
| Find the photograph of the person on this card. Get the exact position of the entire photo. | |
| Return JSON: | |
| { | |
| "label": "face_photo", | |
| "box_2d": [ymin, xmin, ymax, xmax] | |
| } | |
| Coordinates must be normalized between 0 and 1000. | |
| Return ONLY JSON. | |
| """ | |
| # Single model; resize=False so returned bbox coordinates match the | |
| # original image dimensions used later in crop_face(). | |
| _extractor = GeminiExtractor(_PROMPT, models=["gemini-2.5-flash"], resize=False) | |
| def detect_face(image_bytes: bytes) -> dict: | |
| result = _extractor.extract(image_bytes) | |
| return result["data"] | |