Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -26,7 +26,7 @@ import os
|
|
26 |
# Function to perform OCR
|
27 |
def ocr(input_file, lang='fas'): # 'fas': Persian language (Farsi)
|
28 |
extracted_text = ""
|
29 |
-
|
30 |
text = pytesseract.image_to_string(input_file, lang=lang)
|
31 |
extracted_text = text
|
32 |
|
|
|
26 |
# Function to perform OCR
|
27 |
def ocr(input_file, lang='fas'): # 'fas': Persian language (Farsi)
|
28 |
extracted_text = ""
|
29 |
+
if isinstance(input_file, Image.Image): # If the input is an image
|
30 |
text = pytesseract.image_to_string(input_file, lang=lang)
|
31 |
extracted_text = text
|
32 |
|