Spaces:
Sleeping
Sleeping
Upload image_to_text.py
Browse files- image_to_text.py +8 -0
image_to_text.py
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from PIL import Image
|
| 2 |
+
import pytesseract
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def image_to_text(image_path: str) -> str:
|
| 6 |
+
image = Image.open(image_path)
|
| 7 |
+
extracted_text = pytesseract.image_to_string(image)
|
| 8 |
+
return extracted_text
|