Spaces:
Runtime error
Runtime error
Download ocr/gemini_service.py from AdityaAKUMAR/OCR_API: direct link, hf CLI and curl.
- Browser
- Download file 381 Bytes
-
https://huggingface.co/spaces/AdityaAKUMAR/OCR_API/resolve/main/ocr/gemini_service.py
- Command line
-
hf download hf://spaces/AdityaAKUMAR/OCR_API/ocr/gemini_service.py
-
curl -L -o gemini_service.py https://huggingface.co/spaces/AdityaAKUMAR/OCR_API/resolve/main/ocr/gemini_service.py
381 Bytes
| from ocr.base import GeminiExtractor | |
| _PROMPT = """ | |
| Extract PAN card details from this image. | |
| Return JSON in this format: | |
| { | |
| "document_type": "PAN", | |
| "name": "", | |
| "father_name": "", | |
| "pan_number": "", | |
| "date_of_birth": "" | |
| } | |
| Return ONLY valid JSON. | |
| """ | |
| _extractor = GeminiExtractor(_PROMPT) | |
| def parse_pan(image_bytes: bytes) -> dict: | |
| return _extractor.extract(image_bytes) |