npc0 commited on
Commit
29b171e
1 Parent(s): 2e96a51

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import os
2
  import gradio as gr
 
3
  import pytesseract
4
  import yolov5
5
 
@@ -26,16 +27,21 @@ def license_plate_detect(img):
26
  def read_license_number(img):
27
  boxes = license_plate_detect(img)
28
  if len(boxes[0]):
 
29
  return [pytesseract.image_to_string(
30
- Image.crop(bbox.tolist()))
31
  for bbox in boxes]
32
 
33
 
34
  def greet(img):
35
  boxes = license_plate_detect(img)
36
- return "Hello " + str([pytesseract.image_to_string(
37
- img.crop(bbox.tolist()))
38
- for bbox in boxes]) + "!!"
 
 
 
 
39
 
40
 
41
  iface = gr.Interface(fn=greet, inputs="image", outputs="text")
 
1
  import os
2
  import gradio as gr
3
+ from PIL import Image
4
  import pytesseract
5
  import yolov5
6
 
 
27
  def read_license_number(img):
28
  boxes = license_plate_detect(img)
29
  if len(boxes[0]):
30
+ image = Image.fromarray(img)
31
  return [pytesseract.image_to_string(
32
+ image.crop(bbox.tolist()))
33
  for bbox in boxes]
34
 
35
 
36
  def greet(img):
37
  boxes = license_plate_detect(img)
38
+ image = Image.fromarray(img)
39
+ r = 'greet'
40
+ if len(boxes[0]):
41
+ r = [pytesseract.image_to_string(
42
+ image.crop(bbox.tolist()))
43
+ for bbox in boxes]
44
+ return "Hello " + str(r) + "!!"
45
 
46
 
47
  iface = gr.Interface(fn=greet, inputs="image", outputs="text")