isLinXu commited on
Commit
0eb5f90
·
1 Parent(s): c553e79

update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -34,7 +34,7 @@ textdet_model_list = ['DBNet', 'DRRG', 'FCENet', 'PANet', 'PSENet', 'TextSnake',
34
  textrec_model_list = ['ABINet', 'ASTER', 'CRNN', 'MASTER', 'NRTR', 'RobustScanner', 'SARNet', 'SATRN', 'SVTR']
35
  textkie_model_list = ['SDMGR']
36
 
37
- def ocr_inference(inputs, out_dir, det, det_weights, rec, rec_weights, kie, kie_weights, device, batch_size):
38
  init_args, call_args = parse_args()
39
  inputs = np.array(inputs)
40
  img_path = "demo_text_ocr.jpg"
@@ -51,7 +51,7 @@ def ocr_inference(inputs, out_dir, det, det_weights, rec, rec_weights, kie, kie_
51
  init_args['rec_weights'] = rec_weights
52
  call_args['inputs'] = img_path
53
  call_args['out_dir'] = out_dir
54
- call_args['batch_size'] = int(batch_size)
55
  call_args['show'] = False
56
  call_args['save_pred'] = True
57
  call_args['save_vis'] = True
@@ -184,11 +184,11 @@ if __name__ == '__main__':
184
  output_image = gr.outputs.Image(type="pil", label="Output Image")
185
  output_json = gr.outputs.Textbox()
186
  download_test_image()
187
- examples = [["demo_text_ocr.jpg", "results", "DBNet", None, "CRNN", "cpu", 1],
188
- ["demo_text_det.jpg", "results", "FCENet", None, "ASTER", "cpu", 1],
189
- ["demo_text_recog.jpg", "results", "PANet", None, "MASTER", "cpu", 1],
190
- ["demo_densetext_det.jpg", "results", "PSENet", None, "CRNN", None, "cpu", 1],
191
- ["demo_kie.jpg", "results", "TextSnake", None, "RobustScanner", None, "cpu", 1]
192
  ]
193
 
194
  title = "MMOCR web demo"
@@ -202,7 +202,7 @@ if __name__ == '__main__':
202
  iface = gr.Interface(
203
  fn=ocr_inference,
204
  inputs=[
205
- input_image, out_dir, det, det_weights, rec, rec_weights, device, batch_size
206
  ],
207
  outputs=[output_image, output_json], examples=examples,
208
  title=title, description=description, article=article,
 
34
  textrec_model_list = ['ABINet', 'ASTER', 'CRNN', 'MASTER', 'NRTR', 'RobustScanner', 'SARNet', 'SATRN', 'SVTR']
35
  textkie_model_list = ['SDMGR']
36
 
37
+ def ocr_inference(inputs, out_dir, det, det_weights, rec, rec_weights, kie, kie_weights, device):
38
  init_args, call_args = parse_args()
39
  inputs = np.array(inputs)
40
  img_path = "demo_text_ocr.jpg"
 
51
  init_args['rec_weights'] = rec_weights
52
  call_args['inputs'] = img_path
53
  call_args['out_dir'] = out_dir
54
+ call_args['batch_size'] = 1
55
  call_args['show'] = False
56
  call_args['save_pred'] = True
57
  call_args['save_vis'] = True
 
184
  output_image = gr.outputs.Image(type="pil", label="Output Image")
185
  output_json = gr.outputs.Textbox()
186
  download_test_image()
187
+ examples = [["demo_text_ocr.jpg", "results", "DBNet", None, "CRNN", "cpu"],
188
+ ["demo_text_det.jpg", "results", "FCENet", None, "ASTER", "cpu"],
189
+ ["demo_text_recog.jpg", "results", "PANet", None, "MASTER", "cpu"],
190
+ ["demo_densetext_det.jpg", "results", "PSENet", None, "CRNN", None, "cpu"],
191
+ ["demo_kie.jpg", "results", "TextSnake", None, "RobustScanner", None, "cpu"]
192
  ]
193
 
194
  title = "MMOCR web demo"
 
202
  iface = gr.Interface(
203
  fn=ocr_inference,
204
  inputs=[
205
+ input_image, out_dir, det, det_weights, rec, rec_weights, device
206
  ],
207
  outputs=[output_image, output_json], examples=examples,
208
  title=title, description=description, article=article,