Spaces:
Running
Running
Use Moroccan Standard Tamazight model.
Browse files
app.py
CHANGED
@@ -4,11 +4,12 @@ from doctr.models import ocr_predictor, from_hub
|
|
4 |
import gradio as gr
|
5 |
|
6 |
os.environ['USE_TORCH'] = '1'
|
7 |
-
reco_model = from_hub('ayymen/
|
8 |
predictor = ocr_predictor(reco_arch=reco_model, pretrained=True)
|
9 |
|
10 |
title = "Tifinagh OCR"
|
11 |
-
description = "Upload an image to get the OCR results
|
|
|
12 |
|
13 |
def ocr(img):
|
14 |
img.save("out.jpg")
|
@@ -19,7 +20,7 @@ def ocr(img):
|
|
19 |
for obj1 in obj.blocks:
|
20 |
for obj2 in obj1.lines:
|
21 |
for obj3 in obj2.words:
|
22 |
-
res=res + " " + obj3.value
|
23 |
res = res + "\n"
|
24 |
res = res + "\n\n"
|
25 |
_output_name = "RESULT_OCR.txt"
|
|
|
4 |
import gradio as gr
|
5 |
|
6 |
os.environ['USE_TORCH'] = '1'
|
7 |
+
reco_model = from_hub('ayymen/crnn_mobilenet_v3_large_zgh')
|
8 |
predictor = ocr_predictor(reco_arch=reco_model, pretrained=True)
|
9 |
|
10 |
title = "Tifinagh OCR"
|
11 |
+
description = """Upload an image to get the OCR results!
|
12 |
+
Thanks to @iseddik for the data!"""
|
13 |
|
14 |
def ocr(img):
|
15 |
img.save("out.jpg")
|
|
|
20 |
for obj1 in obj.blocks:
|
21 |
for obj2 in obj1.lines:
|
22 |
for obj3 in obj2.words:
|
23 |
+
res = res + " " + obj3.value
|
24 |
res = res + "\n"
|
25 |
res = res + "\n\n"
|
26 |
_output_name = "RESULT_OCR.txt"
|