Charlie Li commited on
Commit
8601923
1 Parent(s): 68dfec7

add some examples

Browse files
app.py CHANGED
@@ -13,7 +13,7 @@ def extract_text_and_boxes(image):
13
  x, y, w, h = data['left'][i], data['top'][i], data['width'][i], data['height'][i]
14
  word = data['text'][i]
15
  boxes_and_words.append({'box': (x, y, w, h), 'word': word})
16
- draw.rectangle([x, y, x + w, y + h], outline='red')
17
 
18
  return image, boxes_and_words
19
 
@@ -22,6 +22,11 @@ iface = gr.Interface(fn=extract_text_and_boxes,
22
  outputs=[gr.Image(type='pil', label="Image with Bounding Boxes"),
23
  gr.JSON(label="Extracted Words and Boxes")],
24
  title="Test Tesseract",
25
- description="Test PyTesseract.")
 
 
 
 
 
26
 
27
  iface.launch()
 
13
  x, y, w, h = data['left'][i], data['top'][i], data['width'][i], data['height'][i]
14
  word = data['text'][i]
15
  boxes_and_words.append({'box': (x, y, w, h), 'word': word})
16
+ draw.rectangle([x, y, x + w, y + h], outline='red', width=2)
17
 
18
  return image, boxes_and_words
19
 
 
22
  outputs=[gr.Image(type='pil', label="Image with Bounding Boxes"),
23
  gr.JSON(label="Extracted Words and Boxes")],
24
  title="Test Tesseract",
25
+ description="Test PyTesseract.",
26
+ examples=[
27
+ ["examples/0OO7hzT.jpg"],
28
+ ["examples/AMzONbY.jpg"],
29
+ ["examples/aDsFny6.jpg"]
30
+ ])
31
 
32
  iface.launch()
examples/0OO7hzT.jpg ADDED
examples/AMzONbY.jpg ADDED
examples/aDsFny6.jpg ADDED