DerrylNessie commited on
Commit
9bccd26
1 Parent(s): 8a1fa4b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -8
app.py CHANGED
@@ -6,13 +6,7 @@ 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)
@@ -33,6 +27,7 @@ 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
  css = ".output_image, .input_image {height: 40rem !important; width: 100% !important;}"
 
36
  choices = [
37
  "abq",
38
  "ady",
@@ -120,7 +115,7 @@ choices = [
120
  ]
121
  gr.Interface(
122
  inference,
123
- [gr.inputs.Image(type='file', label='Input'),gr.inputs.Dropdown(choices, type="value", default=['en'], label='language')],
124
  [gr.outputs.Image(type='file', label='Output'), gr.outputs.Dataframe(headers=['text', 'confidence'])],
125
  title=title,
126
  description=description,
 
6
  import torch
7
  import easyocr
8
 
9
+ torch.hub.download_url_to_file('https://i.pinimg.com/originals/45/d0/30/45d03054e15f4be731781eecba7458a4.jpg', 'korean.png')
 
 
 
 
 
 
10
 
11
  def draw_boxes(image, bounds, color='yellow', width=2):
12
  draw = ImageDraw.Draw(image)
 
27
  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.'
28
  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>"
29
  css = ".output_image, .input_image {height: 40rem !important; width: 100% !important;}"
30
+ examples = [['korean.png',['en']]]
31
  choices = [
32
  "abq",
33
  "ady",
 
115
  ]
116
  gr.Interface(
117
  inference,
118
+ [gr.inputs.Image(type='file', label='Input'),gr.inputs.Dropdown(choices, type="value", default=['ko'], label='language')],
119
  [gr.outputs.Image(type='file', label='Output'), gr.outputs.Dataframe(headers=['text', 'confidence'])],
120
  title=title,
121
  description=description,