isLinXu commited on
Commit
ebd9784
·
1 Parent(s): af964a5

update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -34,7 +34,7 @@ textrec_model_list = ['ABINet', 'ASTER', 'CRNN', 'MASTER', 'NRTR', 'RobustScanne
34
  textkie_model_list = ['SDMGR','SDMGR']
35
 
36
 
37
- def ocr_inference(inputs, out_dir, det, det_weights, rec, rec_weights, device, batch_size):
38
  init_args, call_args = parse_args()
39
  inputs = np.array(inputs)
40
  img_path = "demo_text_ocr.jpg"
@@ -52,7 +52,7 @@ def ocr_inference(inputs, out_dir, det, det_weights, rec, rec_weights, device, b
52
 
53
  call_args['inputs'] = img_path
54
  call_args['out_dir'] = out_dir
55
- call_args['batch_size'] = int(batch_size)
56
  call_args['show'] = False
57
  call_args['save_pred'] = True
58
  call_args['save_vis'] = True
@@ -189,11 +189,11 @@ if __name__ == '__main__':
189
  output_image = gr.outputs.Image(type="pil", label="Output Image")
190
  output_json = gr.outputs.Textbox()
191
  download_test_image()
192
- examples = [["demo_text_ocr.jpg", "results", "DBNet", None, "CRNN", None, "cpu", 1],
193
- ["demo_text_det.jpg", "results", "FCENet", None, "ASTER", None, "cpu", 1],
194
- ["demo_text_recog.jpg", "results", "PANet", None, "MASTER", None, "cpu", 1],
195
- ["demo_densetext_det.jpg", "results", "PSENet", None, "CRNN", None, "cpu", 1],
196
- ["demo_kie.jpg", "results", "TextSnake", None, "RobustScanner", None, "cpu", 1]
197
  ]
198
 
199
  title = "MMOCR web demo"
 
34
  textkie_model_list = ['SDMGR','SDMGR']
35
 
36
 
37
+ def ocr_inference(inputs, out_dir, det, det_weights, rec, rec_weights, device):
38
  init_args, call_args = parse_args()
39
  inputs = np.array(inputs)
40
  img_path = "demo_text_ocr.jpg"
 
52
 
53
  call_args['inputs'] = img_path
54
  call_args['out_dir'] = out_dir
55
+ call_args['batch_size'] = 1
56
  call_args['show'] = False
57
  call_args['save_pred'] = True
58
  call_args['save_vis'] = True
 
189
  output_image = gr.outputs.Image(type="pil", label="Output Image")
190
  output_json = gr.outputs.Textbox()
191
  download_test_image()
192
+ examples = [["demo_text_ocr.jpg", "results", "DBNet", None, "CRNN", None, "cpu"],
193
+ ["demo_text_det.jpg", "results", "FCENet", None, "ASTER", None, "cpu"],
194
+ ["demo_text_recog.jpg", "results", "PANet", None, "MASTER", None, "cpu"],
195
+ ["demo_densetext_det.jpg", "results", "PSENet", None, "CRNN", None, "cpu"],
196
+ ["demo_kie.jpg", "results", "TextSnake", None, "RobustScanner", None, "cpu"]
197
  ]
198
 
199
  title = "MMOCR web demo"