Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,13 +1,9 @@
|
|
1 |
import gradio as gr
|
2 |
import pytesseract
|
3 |
-
import cv2
|
4 |
|
5 |
def process(image, lang):
|
6 |
try:
|
7 |
-
|
8 |
-
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
|
9 |
-
threshold_img = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)[1]
|
10 |
-
return pytesseract.image_to_string(threshold_img, lang=lang)
|
11 |
except Exception as e:
|
12 |
return str(e)
|
13 |
|
|
|
1 |
import gradio as gr
|
2 |
import pytesseract
|
|
|
3 |
|
4 |
def process(image, lang):
|
5 |
try:
|
6 |
+
return pytesseract.image_to_string(image, lang=lang)
|
|
|
|
|
|
|
7 |
except Exception as e:
|
8 |
return str(e)
|
9 |
|