Spaces:
Runtime error
Runtime error
Update text_extraction.py
Browse files- text_extraction.py +3 -0
text_extraction.py
CHANGED
|
@@ -1,6 +1,9 @@
|
|
| 1 |
import pytesseract
|
| 2 |
from PIL import Image
|
| 3 |
|
|
|
|
|
|
|
|
|
|
| 4 |
def extract_text(image):
|
| 5 |
"""Extracts text from the diagram using OCR."""
|
| 6 |
return pytesseract.image_to_string(Image.fromarray(image))
|
|
|
|
| 1 |
import pytesseract
|
| 2 |
from PIL import Image
|
| 3 |
|
| 4 |
+
# Set the Tesseract command path explicitly
|
| 5 |
+
pytesseract.pytesseract.tesseract_cmd = "/usr/bin/tesseract"
|
| 6 |
+
|
| 7 |
def extract_text(image):
|
| 8 |
"""Extracts text from the diagram using OCR."""
|
| 9 |
return pytesseract.image_to_string(Image.fromarray(image))
|