awacke1 commited on
Commit
a912d85
·
1 Parent(s): 2df2c0f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +69 -1
app.py CHANGED
@@ -6,10 +6,78 @@ 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/chinese.jpg', 'chinese.jpg')
11
  torch.hub.download_url_to_file('https://github.com/JaidedAI/EasyOCR/raw/master/examples/japanese.jpg', 'japanese.jpg')
12
  torch.hub.download_url_to_file('https://i.imgur.com/mwQFd7G.jpeg', 'Hindi.jpeg')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  def draw_boxes(image, bounds, color='yellow', width=2):
15
  draw = ImageDraw.Draw(image)
@@ -29,8 +97,8 @@ def inference(img, lang):
29
  title = 'Image To Optical Character Recognition'
30
  description = 'Multilingual OCR which works conveniently on all devices in multiple languages.'
31
  article = "<p style='text-align: center'></p>"
32
- examples = [['english.png',['en']],['chinese.jpg',['ch_sim', 'en']],['japanese.jpg',['ja', 'en']],['Hindi.jpeg',['hi', 'en']]]
33
  css = ".output_image, .input_image {height: 40rem !important; width: 100% !important;}"
 
34
  choices = [
35
  "ch_sim",
36
  "ch_tra",
 
6
  import torch
7
  import easyocr
8
 
9
+
10
+ torch.hub.download_url_to_file('https://github.com/AaronCWacker/Yggdrasil/blob/main/images/20-Books.jpg', '20-Books.jpg')
11
+ torch.hub.download_url_to_file('https://github.com/AaronCWacker/Yggdrasil/blob/main/images/21-Books.jpg', '21-Books.jpg')
12
+ torch.hub.download_url_to_file('https://github.com/AaronCWacker/Yggdrasil/blob/main/images/22-Magazines.jpg', '22-Magazines.jpg')
13
+ torch.hub.download_url_to_file('https://github.com/AaronCWacker/Yggdrasil/blob/main/images/23-Magazines.jpg', '23-Magazines.jpg')
14
+ torch.hub.download_url_to_file('https://github.com/AaronCWacker/Yggdrasil/blob/main/images/24-Card-Games.jpg', '24-Card-Games.jpg')
15
+ torch.hub.download_url_to_file('https://github.com/AaronCWacker/Yggdrasil/blob/main/images/25-Games.jpg', '25-Games.jpg')
16
+ torch.hub.download_url_to_file('https://github.com/AaronCWacker/Yggdrasil/blob/main/images/26-Books.jpg', '26-Books.jpg')
17
+ torch.hub.download_url_to_file('https://github.com/AaronCWacker/Yggdrasil/blob/main/images/27-Books.jpg', '27-Books.jpg')
18
+ torch.hub.download_url_to_file('https://github.com/AaronCWacker/Yggdrasil/blob/main/images/28-Books.jpg', '28-Books.jpg')
19
+ torch.hub.download_url_to_file('https://github.com/AaronCWacker/Yggdrasil/blob/main/images/27-Games.jpg', '27-Games.jpg')
20
+ torch.hub.download_url_to_file('https://github.com/AaronCWacker/Yggdrasil/blob/main/images/28-Games.jpg', '28-Games.jpg')
21
+ torch.hub.download_url_to_file('https://github.com/AaronCWacker/Yggdrasil/blob/main/images/29-Books-Science-Fiction.jpg', '29-Books-Science-Fiction.jpg')
22
+ torch.hub.download_url_to_file('https://github.com/AaronCWacker/Yggdrasil/blob/main/images/30-Manga-Books.jpg', '30-Manga-Books.jpg')
23
+ torch.hub.download_url_to_file('https://github.com/AaronCWacker/Yggdrasil/blob/main/images/31-Books.jpg', '31-Books.jpg')
24
+ torch.hub.download_url_to_file('https://github.com/AaronCWacker/Yggdrasil/blob/main/images/32-Books.jpg', '32-Books.jpg')
25
+ torch.hub.download_url_to_file('https://github.com/AaronCWacker/Yggdrasil/blob/main/images/33-Game-Night.jpg', '33-Game-Night.jpg')
26
+ torch.hub.download_url_to_file('https://github.com/AaronCWacker/Yggdrasil/blob/main/images/34-Games.jpg', '34-Games.jpg')
27
+ torch.hub.download_url_to_file('https://github.com/AaronCWacker/Yggdrasil/blob/main/images/35-Favorite-Games.jpg', '35-Favorite-Games.jpg')
28
+ torch.hub.download_url_to_file('https://github.com/AaronCWacker/Yggdrasil/blob/main/images/36-Game-Night.jpg', '36-Game-Night.jpg')
29
+ torch.hub.download_url_to_file('https://github.com/AaronCWacker/Yggdrasil/blob/main/images/38-Strategy-Games.jpg', '38-Strategy-Games.jpg')
30
+ torch.hub.download_url_to_file('https://github.com/AaronCWacker/Yggdrasil/blob/main/images/39-Games.jpg', '39-Games.jpg')
31
+ torch.hub.download_url_to_file('https://github.com/AaronCWacker/Yggdrasil/blob/main/images/40-Games.jpg', '40-Games.jpg')
32
+ torch.hub.download_url_to_file('https://github.com/AaronCWacker/Yggdrasil/blob/main/images/41-Game-Rules.jpg', '41-Game-Rules.jpg')
33
+ torch.hub.download_url_to_file('https://github.com/AaronCWacker/Yggdrasil/blob/main/images/42-Game-Rules.jpg', '42-Game-Rules.jpg')
34
+ torch.hub.download_url_to_file('https://github.com/AaronCWacker/Yggdrasil/blob/main/images/43-Games-Pieces.jpg', '43-Games-Pieces.jpg')
35
+ torch.hub.download_url_to_file('https://github.com/AaronCWacker/Yggdrasil/blob/main/images/44-Game-Pieces.jpg', '44-Game-Pieces.jpg')
36
+ torch.hub.download_url_to_file('https://github.com/AaronCWacker/Yggdrasil/blob/main/images/45-Choose-Your-Own-Adventure.jpg', '45-Choose-Your-Own-Adventure.jpg')
37
+ torch.hub.download_url_to_file('https://github.com/AaronCWacker/Yggdrasil/blob/main/images/46-Choose-Your-Own-Adventure.jpg', '46-Choose-Your-Own-Adventure.jpg')
38
+
39
+
40
  torch.hub.download_url_to_file('https://github.com/JaidedAI/EasyOCR/raw/master/examples/english.png', 'english.png')
41
  torch.hub.download_url_to_file('https://github.com/JaidedAI/EasyOCR/raw/master/examples/chinese.jpg', 'chinese.jpg')
42
  torch.hub.download_url_to_file('https://github.com/JaidedAI/EasyOCR/raw/master/examples/japanese.jpg', 'japanese.jpg')
43
  torch.hub.download_url_to_file('https://i.imgur.com/mwQFd7G.jpeg', 'Hindi.jpeg')
44
+ examples = [
45
+ ['20-Books.jpg',['en']],
46
+ ['21-Books.jpg',['en']],
47
+ ['22-Magazines.jpg',['en']],
48
+ ['23-Magazines.jpg',['en']],
49
+ ['24-Card-Games.jpg',['en']],
50
+ ['25-Games.jpg',['en']],
51
+ ['26-Books.jpg',['en']],
52
+ ['27-Books.jpg',['en']],
53
+ ['28-Books.jpg',['en']],
54
+ ['27-Games.jpg',['en']],
55
+ ['28-Games.jpg',['en']],
56
+ ['29-Books-Science-Fiction.jpg',['en']],
57
+ ['30-Manga-Books.jpg',['en']],
58
+ ['31-Books.jpg',['en']],
59
+ ['32-Books.jpg',['en']],
60
+ ['33-Game-Night.jpg',['en']],
61
+ ['34-Games.jpg',['en']],
62
+ ['35-Favorite-Games.jpg',['en']],
63
+ ['36-Game-Night.jpg',['en']],
64
+ ['38-Strategy-Games.jpg',['en']],
65
+ ['39-Games.jpg',['en']],
66
+ ['40-Games.jpg',['en']],
67
+ ['41-Game-Rules.jpg',['en']],
68
+ ['42-Game-Rules.jpg',['en']],
69
+ ['43-Games-Pieces.jpg',['en']],
70
+ ['44-Game-Pieces.jpg',['en']],
71
+ ['45-Choose-Your-Own-Adventure.jpg',['en']],
72
+ ['46-Choose-Your-Own-Adventure.jpg',['en']],
73
+ ['english.png',['en']],
74
+ ['chinese.jpg',['ch_sim', 'en']],
75
+ ['japanese.jpg',['ja', 'en']],
76
+ ['Hindi.jpeg',['hi', 'en']]
77
+ ]
78
+
79
+
80
+
81
 
82
  def draw_boxes(image, bounds, color='yellow', width=2):
83
  draw = ImageDraw.Draw(image)
 
97
  title = 'Image To Optical Character Recognition'
98
  description = 'Multilingual OCR which works conveniently on all devices in multiple languages.'
99
  article = "<p style='text-align: center'></p>"
 
100
  css = ".output_image, .input_image {height: 40rem !important; width: 100% !important;}"
101
+
102
  choices = [
103
  "ch_sim",
104
  "ch_tra",