Spaces:
Runtime error
Runtime error
Commit
•
20e28ec
1
Parent(s):
dfac7a0
Update app.py
Browse files
app.py
CHANGED
@@ -16,6 +16,14 @@ def draw_boxes(image, bounds, color='yellow', width=2):
|
|
16 |
return image
|
17 |
|
18 |
def inference(img, lang):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
reader = easyocr.Reader(lang)
|
20 |
bounds = reader.readtext(img.name)
|
21 |
im = PIL.Image.open(img.name)
|
@@ -29,89 +37,10 @@ article = "<p style='text-align: center'><a href='https://www.jaided.ai/easyocr/
|
|
29 |
css = ".output_image, .input_image {height: 40rem !important; width: 100% !important;}"
|
30 |
examples = [['korean.png',['ko']]]
|
31 |
choices = [
|
32 |
-
"
|
33 |
-
"
|
34 |
-
"
|
35 |
-
"
|
36 |
-
"ar",
|
37 |
-
"as",
|
38 |
-
"ava",
|
39 |
-
"az",
|
40 |
-
"be",
|
41 |
-
"bg",
|
42 |
-
"bh",
|
43 |
-
"bho",
|
44 |
-
"bn",
|
45 |
-
"bs",
|
46 |
-
"ch_sim",
|
47 |
-
"ch_tra",
|
48 |
-
"che",
|
49 |
-
"cs",
|
50 |
-
"cy",
|
51 |
-
"da",
|
52 |
-
"dar",
|
53 |
-
"de",
|
54 |
-
"en",
|
55 |
-
"es",
|
56 |
-
"et",
|
57 |
-
"fa",
|
58 |
-
"fr",
|
59 |
-
"ga",
|
60 |
-
"gom",
|
61 |
-
"hi",
|
62 |
-
"hr",
|
63 |
-
"hu",
|
64 |
-
"id",
|
65 |
-
"inh",
|
66 |
-
"is",
|
67 |
-
"it",
|
68 |
-
"ja",
|
69 |
-
"kbd",
|
70 |
-
"kn",
|
71 |
-
"ko",
|
72 |
-
"ku",
|
73 |
-
"la",
|
74 |
-
"lbe",
|
75 |
-
"lez",
|
76 |
-
"lt",
|
77 |
-
"lv",
|
78 |
-
"mah",
|
79 |
-
"mai",
|
80 |
-
"mi",
|
81 |
-
"mn",
|
82 |
-
"mr",
|
83 |
-
"ms",
|
84 |
-
"mt",
|
85 |
-
"ne",
|
86 |
-
"new",
|
87 |
-
"nl",
|
88 |
-
"no",
|
89 |
-
"oc",
|
90 |
-
"pi",
|
91 |
-
"pl",
|
92 |
-
"pt",
|
93 |
-
"ro",
|
94 |
-
"ru",
|
95 |
-
"rs_cyrillic",
|
96 |
-
"rs_latin",
|
97 |
-
"sck",
|
98 |
-
"sk",
|
99 |
-
"sl",
|
100 |
-
"sq",
|
101 |
-
"sv",
|
102 |
-
"sw",
|
103 |
-
"ta",
|
104 |
-
"tab",
|
105 |
-
"te",
|
106 |
-
"th",
|
107 |
-
"tjk",
|
108 |
-
"tl",
|
109 |
-
"tr",
|
110 |
-
"ug",
|
111 |
-
"uk",
|
112 |
-
"ur",
|
113 |
-
"uz",
|
114 |
-
"vi"
|
115 |
]
|
116 |
gr.Interface(
|
117 |
inference,
|
|
|
16 |
return image
|
17 |
|
18 |
def inference(img, lang):
|
19 |
+
if lang == "english":
|
20 |
+
lang = 'en'
|
21 |
+
elif lang == "chinese":
|
22 |
+
lang = 'ch_sim'
|
23 |
+
elif lang == "korean":
|
24 |
+
lang = 'ko'
|
25 |
+
else:
|
26 |
+
lang = 'ja'
|
27 |
reader = easyocr.Reader(lang)
|
28 |
bounds = reader.readtext(img.name)
|
29 |
im = PIL.Image.open(img.name)
|
|
|
37 |
css = ".output_image, .input_image {height: 40rem !important; width: 100% !important;}"
|
38 |
examples = [['korean.png',['ko']]]
|
39 |
choices = [
|
40 |
+
"chinese",
|
41 |
+
"english",
|
42 |
+
"japanese",
|
43 |
+
"korean",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
]
|
45 |
gr.Interface(
|
46 |
inference,
|