File size: 1,088 Bytes
1da9954
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""
दृष्टी स्तर: प्रतिमेतून मराठी मजकूर वाचणे
"""
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
        }