Download ocr/engine.py from kalpesh77/Vedic: direct link, hf CLI and curl.
- Browser
- Download file 1.09 kB
-
https://huggingface.co/kalpesh77/Vedic/resolve/main/ocr/engine.py
- Command line
-
hf download hf://kalpesh77/Vedic/ocr/engine.py
-
curl -L -o engine.py https://huggingface.co/kalpesh77/Vedic/resolve/main/ocr/engine.py
1.09 kB
| """ | |
| दृष्टी स्तर: प्रतिमेतून मराठी मजकूर वाचणे | |
| """ | |
| import pytesseract | |
| from PIL import Image | |
| class MarathiOCR: | |
| """वैदिक मराठी OCR इंजिन""" | |
| def __init__(self, tesseract_path='/usr/bin/tesseract'): | |
| pytesseract.pytesseract.tesseract_cmd = tesseract_path | |
| def read_image(self, image_path): | |
| """👁️ दृष्टी: प्रतिमेतून मराठी मजकूर वाचणे""" | |
| img = Image.open(image_path) | |
| return pytesseract.image_to_string(img, lang='mar') | |
| def process(self, image_path): | |
| """संपूर्ण पाइपलाइन: OCR + बोलीभाषा + सांकेतिक भाषा""" | |
| from .decomposer import generate_stable_outputs | |
| text = self.read_image(image_path) | |
| boli, symbolic = generate_stable_outputs(text) | |
| return { | |
| 'raw': text, | |
| 'boli': boli, | |
| 'symbolic': symbolic | |
| } | |