9prayer commited on
Commit
25c0532
·
verified ·
1 Parent(s): c42052d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -7
app.py CHANGED
@@ -10,17 +10,13 @@ import easyocr
10
  def process(img_path):
11
  reader = easyocr.Reader(['en'])
12
  bounds = reader.readtext(img_path)
13
- pim = PIL.Image.open(img_path)
14
- draw = ImageDraw.Draw(pim)
15
- for bound in bounds:
16
- p0, p1, p2, p3 = bound[0]
17
- draw.line([*p0, *p1, *p2, *p3, *p0], fill = 'yellow', width = 2)
18
- return [pim, pd.DataFrame(bounds).iloc[: , 1:]]
19
 
20
  title = '车架号识别展示'
21
  description = '拖拽图片到识别区开始分析'
22
  ip = gr.Image(sources = ['upload'], label = '上传图片', width = '100%', height = '40rem', type = 'filepath')
23
- op = [gr.Image(sources = None, label = '处理结果', width = '100%', height = '40rem', type = 'pil'), gr.Dataframe(col_count = (1, 'fixed'), show_label = False)]
24
  css = """
25
  table.svelte-y11bhb.svelte-y11bhb { max-width: 100%; overflow-x: hidden; }
26
  thead.svelte-y11bhb.svelte-y11bhb { visibility: hidden; }
 
10
  def process(img_path):
11
  reader = easyocr.Reader(['en'])
12
  bounds = reader.readtext(img_path)
13
+
14
+ return [img_path, pd.DataFrame(bounds).iloc[: , 1:]]
 
 
 
 
15
 
16
  title = '车架号识别展示'
17
  description = '拖拽图片到识别区开始分析'
18
  ip = gr.Image(sources = ['upload'], label = '上传图片', width = '100%', height = '40rem', type = 'filepath')
19
+ op = [gr.Image(sources = None, label = '处理结果', width = '100%', height = '40rem', type = 'filepath'), gr.Dataframe(col_count = (1, 'fixed'), show_label = False)]
20
  css = """
21
  table.svelte-y11bhb.svelte-y11bhb { max-width: 100%; overflow-x: hidden; }
22
  thead.svelte-y11bhb.svelte-y11bhb { visibility: hidden; }