fix
Browse files- app.py +2 -5
- requirements.txt +3 -1
app.py
CHANGED
@@ -5,16 +5,13 @@ import PIL
|
|
5 |
from PIL import Image
|
6 |
|
7 |
def recognize_text(image):
|
8 |
-
|
9 |
-
|
10 |
-
result = reader.readtext(image.name)
|
11 |
ocr_text = ""
|
12 |
for data in result:
|
13 |
ocr_text += data[1]
|
14 |
ocr_text += "_"
|
15 |
return ocr_text
|
16 |
-
except:
|
17 |
-
return "error"
|
18 |
|
19 |
iface = gr.Interface(fn=recognize_text, inputs="image", outputs="text")
|
20 |
iface.launch()
|
|
|
5 |
from PIL import Image
|
6 |
|
7 |
def recognize_text(image):
|
8 |
+
reader = easyocr.Reader(["ja"])
|
9 |
+
result = reader.readtext(image)
|
|
|
10 |
ocr_text = ""
|
11 |
for data in result:
|
12 |
ocr_text += data[1]
|
13 |
ocr_text += "_"
|
14 |
return ocr_text
|
|
|
|
|
15 |
|
16 |
iface = gr.Interface(fn=recognize_text, inputs="image", outputs="text")
|
17 |
iface.launch()
|
requirements.txt
CHANGED
@@ -1,2 +1,4 @@
|
|
1 |
opencv-python
|
2 |
-
easyocr
|
|
|
|
|
|
1 |
opencv-python
|
2 |
+
easyocr
|
3 |
+
Pillow
|
4 |
+
gradio
|