npc0 commited on
Commit
af06ad9
1 Parent(s): 640ce1c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -1,6 +1,5 @@
1
  import os
2
  import gradio as gr
3
- from PIL import Image
4
  import pytesseract
5
  import yolov5
6
 
@@ -31,9 +30,8 @@ def license_plate_detect(img):
31
  def read_license_number(img):
32
  boxes = license_plate_detect(img)
33
  if boxes is not None:
34
- image = Image.fromarray(img)
35
  return [pytesseract.image_to_string(
36
- image.crop(bbox.tolist()))
37
  for bbox in boxes]
38
 
39
 
@@ -79,5 +77,5 @@ def greet(img):
79
  return (img, "空地。。。")
80
 
81
 
82
- iface = gr.Interface(fn=greet, inputs="image", outputs="text")
83
  iface.launch()
 
1
  import os
2
  import gradio as gr
 
3
  import pytesseract
4
  import yolov5
5
 
 
30
  def read_license_number(img):
31
  boxes = license_plate_detect(img)
32
  if boxes is not None:
 
33
  return [pytesseract.image_to_string(
34
+ img.crop(bbox.tolist()))
35
  for bbox in boxes]
36
 
37
 
 
77
  return (img, "空地。。。")
78
 
79
 
80
+ iface = gr.Interface(fn=greet, inputs=gr.Image(type="pil"), outputs="text")
81
  iface.launch()