Spaces:
Runtime error
Runtime error
Commit
·
f4de4aa
1
Parent(s):
20e28ec
Update app.py
Browse files
app.py
CHANGED
@@ -16,14 +16,14 @@ def draw_boxes(image, bounds, color='yellow', width=2):
|
|
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)
|
@@ -35,16 +35,16 @@ title = 'EasyOCR'
|
|
35 |
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.'
|
36 |
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>"
|
37 |
css = ".output_image, .input_image {height: 40rem !important; width: 100% !important;}"
|
38 |
-
examples = [['korean.png',[
|
39 |
choices = [
|
40 |
"chinese",
|
41 |
"english",
|
42 |
"japanese",
|
43 |
-
"korean"
|
44 |
]
|
45 |
gr.Interface(
|
46 |
inference,
|
47 |
-
[gr.inputs.Image(type='file', label='Input'),gr.inputs.Dropdown(choices, type="value", default=[
|
48 |
[gr.outputs.Image(type='file', label='Output'), gr.outputs.Dataframe(headers=['text', 'confidence'])],
|
49 |
title=title,
|
50 |
description=description,
|
|
|
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)
|
|
|
35 |
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.'
|
36 |
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>"
|
37 |
css = ".output_image, .input_image {height: 40rem !important; width: 100% !important;}"
|
38 |
+
examples = [['korean.png',["korean"]]]
|
39 |
choices = [
|
40 |
"chinese",
|
41 |
"english",
|
42 |
"japanese",
|
43 |
+
"korean"
|
44 |
]
|
45 |
gr.Interface(
|
46 |
inference,
|
47 |
+
[gr.inputs.Image(type='file', label='Input'),gr.inputs.Dropdown(choices, type="value", default=["korean"], label='language')],
|
48 |
[gr.outputs.Image(type='file', label='Output'), gr.outputs.Dataframe(headers=['text', 'confidence'])],
|
49 |
title=title,
|
50 |
description=description,
|