Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -6,13 +6,13 @@ import gradio as gr
|
|
6 |
import torch
|
7 |
import easyocr
|
8 |
|
9 |
-
torch.hub.download_url_to_file('https://github.com/JaidedAI/EasyOCR/raw/master/examples/english.png', 'english.png')
|
10 |
-
torch.hub.download_url_to_file('https://github.com/JaidedAI/EasyOCR/raw/master/examples/thai.jpg', 'thai.jpg')
|
11 |
-
torch.hub.download_url_to_file('https://github.com/JaidedAI/EasyOCR/raw/master/examples/french.jpg', 'french.jpg')
|
12 |
-
torch.hub.download_url_to_file('https://github.com/JaidedAI/EasyOCR/raw/master/examples/chinese.jpg', 'chinese.jpg')
|
13 |
-
torch.hub.download_url_to_file('https://github.com/JaidedAI/EasyOCR/raw/master/examples/japanese.jpg', 'japanese.jpg')
|
14 |
-
torch.hub.download_url_to_file('https://github.com/JaidedAI/EasyOCR/raw/master/examples/korean.png', 'korean.png')
|
15 |
-
torch.hub.download_url_to_file('https://i.imgur.com/mwQFd7G.jpeg', 'Hindi.jpeg')
|
16 |
|
17 |
def draw_boxes(image, bounds, color='yellow', width=2):
|
18 |
draw = ImageDraw.Draw(image)
|
@@ -35,89 +35,8 @@ article = "<p style='text-align: center'><a href='https://www.jaided.ai/easyocr/
|
|
35 |
examples = [['./e1.jpg',['ar','en']],['./e2.jpg',['ar','en']], ['./e3.jpg',['ar','en']], ['./e4.jpg',['ar','en']], ['./e5.jpg',['ar','en']]]
|
36 |
css = ".output_image, .input_image {height: 40rem !important; width: 100% !important;}"
|
37 |
choices = [
|
38 |
-
"abq",
|
39 |
-
"ady",
|
40 |
-
"af",
|
41 |
-
"ang",
|
42 |
"ar",
|
43 |
-
"as",
|
44 |
-
"ava",
|
45 |
-
"az",
|
46 |
-
"be",
|
47 |
-
"bg",
|
48 |
-
"bh",
|
49 |
-
"bho",
|
50 |
-
"bn",
|
51 |
-
"bs",
|
52 |
-
"ch_sim",
|
53 |
-
"ch_tra",
|
54 |
-
"che",
|
55 |
-
"cs",
|
56 |
-
"cy",
|
57 |
-
"da",
|
58 |
-
"dar",
|
59 |
-
"de",
|
60 |
"en",
|
61 |
-
"es",
|
62 |
-
"et",
|
63 |
-
"fa",
|
64 |
-
"fr",
|
65 |
-
"ga",
|
66 |
-
"gom",
|
67 |
-
"hi",
|
68 |
-
"hr",
|
69 |
-
"hu",
|
70 |
-
"id",
|
71 |
-
"inh",
|
72 |
-
"is",
|
73 |
-
"it",
|
74 |
-
"ja",
|
75 |
-
"kbd",
|
76 |
-
"kn",
|
77 |
-
"ko",
|
78 |
-
"ku",
|
79 |
-
"la",
|
80 |
-
"lbe",
|
81 |
-
"lez",
|
82 |
-
"lt",
|
83 |
-
"lv",
|
84 |
-
"mah",
|
85 |
-
"mai",
|
86 |
-
"mi",
|
87 |
-
"mn",
|
88 |
-
"mr",
|
89 |
-
"ms",
|
90 |
-
"mt",
|
91 |
-
"ne",
|
92 |
-
"new",
|
93 |
-
"nl",
|
94 |
-
"no",
|
95 |
-
"oc",
|
96 |
-
"pi",
|
97 |
-
"pl",
|
98 |
-
"pt",
|
99 |
-
"ro",
|
100 |
-
"ru",
|
101 |
-
"rs_cyrillic",
|
102 |
-
"rs_latin",
|
103 |
-
"sck",
|
104 |
-
"sk",
|
105 |
-
"sl",
|
106 |
-
"sq",
|
107 |
-
"sv",
|
108 |
-
"sw",
|
109 |
-
"ta",
|
110 |
-
"tab",
|
111 |
-
"te",
|
112 |
-
"th",
|
113 |
-
"tjk",
|
114 |
-
"tl",
|
115 |
-
"tr",
|
116 |
-
"ug",
|
117 |
-
"uk",
|
118 |
-
"ur",
|
119 |
-
"uz",
|
120 |
-
"vi"
|
121 |
]
|
122 |
gr.Interface(
|
123 |
inference,
|
|
|
6 |
import torch
|
7 |
import easyocr
|
8 |
|
9 |
+
# torch.hub.download_url_to_file('https://github.com/JaidedAI/EasyOCR/raw/master/examples/english.png', 'english.png')
|
10 |
+
# torch.hub.download_url_to_file('https://github.com/JaidedAI/EasyOCR/raw/master/examples/thai.jpg', 'thai.jpg')
|
11 |
+
# torch.hub.download_url_to_file('https://github.com/JaidedAI/EasyOCR/raw/master/examples/french.jpg', 'french.jpg')
|
12 |
+
# torch.hub.download_url_to_file('https://github.com/JaidedAI/EasyOCR/raw/master/examples/chinese.jpg', 'chinese.jpg')
|
13 |
+
# torch.hub.download_url_to_file('https://github.com/JaidedAI/EasyOCR/raw/master/examples/japanese.jpg', 'japanese.jpg')
|
14 |
+
# torch.hub.download_url_to_file('https://github.com/JaidedAI/EasyOCR/raw/master/examples/korean.png', 'korean.png')
|
15 |
+
# torch.hub.download_url_to_file('https://i.imgur.com/mwQFd7G.jpeg', 'Hindi.jpeg')
|
16 |
|
17 |
def draw_boxes(image, bounds, color='yellow', width=2):
|
18 |
draw = ImageDraw.Draw(image)
|
|
|
35 |
examples = [['./e1.jpg',['ar','en']],['./e2.jpg',['ar','en']], ['./e3.jpg',['ar','en']], ['./e4.jpg',['ar','en']], ['./e5.jpg',['ar','en']]]
|
36 |
css = ".output_image, .input_image {height: 40rem !important; width: 100% !important;}"
|
37 |
choices = [
|
|
|
|
|
|
|
|
|
38 |
"ar",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
"en",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
]
|
41 |
gr.Interface(
|
42 |
inference,
|