Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,13 @@ import gradio as gr
|
|
6 |
import torch
|
7 |
import easyocr
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
def draw_boxes(image, bounds, color='yellow', width=2):
|
11 |
draw = ImageDraw.Draw(image)
|
@@ -23,6 +30,9 @@ def inference(img, lang):
|
|
23 |
return ['result.jpg', pd.DataFrame(bounds).iloc[: , 1:]]
|
24 |
|
25 |
title = 'EasyOCR'
|
|
|
|
|
|
|
26 |
css = ".output_image, .input_image {height: 40rem !important; width: 100% !important;}"
|
27 |
choices = [
|
28 |
"abq",
|
|
|
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)
|
|
|
30 |
return ['result.jpg', pd.DataFrame(bounds).iloc[: , 1:]]
|
31 |
|
32 |
title = 'EasyOCR'
|
33 |
+
description = 'Gradio demo for EasyOCR. EasyOCR demo supports 80+ languages.To use it, simply upload your image and choose a language from the dropdown menu, or click one of the examples to load them. Read more at the links below.'
|
34 |
+
article = "<p style='text-align: center'><a href='https://www.jaided.ai/easyocr/'>Ready-to-use OCR with 80+ supported languages and all popular writing scripts including Latin, Chinese, Arabic, Devanagari, Cyrillic and etc.</a> | <a href='https://github.com/JaidedAI/EasyOCR'>Github Repo</a></p>"
|
35 |
+
examples = [['english.png',['en']],['thai.jpg',['th']],['french.jpg',['fr', 'en']],['chinese.jpg',['ch_sim', 'en']],['japanese.jpg',['ja', 'en']],['korean.png',['ko', 'en']],['Hindi.jpeg',['hi', 'en']]]
|
36 |
css = ".output_image, .input_image {height: 40rem !important; width: 100% !important;}"
|
37 |
choices = [
|
38 |
"abq",
|