Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -22,14 +22,6 @@ config['device'] = 'cpu' # mps
|
|
22 |
|
23 |
recognitor = Predictor(config)
|
24 |
|
25 |
-
torch.hub.download_url_to_file('https://github.com/JaidedAI/EasyOCR/raw/master/examples/english.png', 'english.png')
|
26 |
-
torch.hub.download_url_to_file('https://github.com/JaidedAI/EasyOCR/raw/master/examples/thai.jpg', 'thai.jpg')
|
27 |
-
torch.hub.download_url_to_file('https://github.com/JaidedAI/EasyOCR/raw/master/examples/french.jpg', 'french.jpg')
|
28 |
-
torch.hub.download_url_to_file('https://github.com/JaidedAI/EasyOCR/raw/master/examples/chinese.jpg', 'chinese.jpg')
|
29 |
-
torch.hub.download_url_to_file('https://github.com/JaidedAI/EasyOCR/raw/master/examples/japanese.jpg', 'japanese.jpg')
|
30 |
-
torch.hub.download_url_to_file('https://github.com/JaidedAI/EasyOCR/raw/master/examples/korean.png', 'korean.png')
|
31 |
-
torch.hub.download_url_to_file('https://i.imgur.com/mwQFd7G.jpeg', 'Hindi.jpeg')
|
32 |
-
|
33 |
def draw_boxes(image, bounds, color='yellow', width=2):
|
34 |
draw = ImageDraw.Draw(image)
|
35 |
for bound in bounds:
|
@@ -55,6 +47,7 @@ def inference(filepath, lang):
|
|
55 |
try:
|
56 |
cropped_image = Image.fromarray(cropped_image)
|
57 |
except:
|
|
|
58 |
continue
|
59 |
|
60 |
out = recognitor.predict(cropped_image)
|
|
|
22 |
|
23 |
recognitor = Predictor(config)
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
def draw_boxes(image, bounds, color='yellow', width=2):
|
26 |
draw = ImageDraw.Draw(image)
|
27 |
for bound in bounds:
|
|
|
47 |
try:
|
48 |
cropped_image = Image.fromarray(cropped_image)
|
49 |
except:
|
50 |
+
print('cropping error')
|
51 |
continue
|
52 |
|
53 |
out = recognitor.predict(cropped_image)
|