Spaces:
Build error
Build error
Update app.py
Browse files10 unmodified lines11121314141516181718195 unmodified lines252627302829303110 unmodified linesMODEL = LayoutLMForQuestionAnswering.from_pretrained(model_tag).eval()TOKENIZER = AutoTokenizer.from_pretrained(model_tag)OCR = PaddleOCR( use_angle_cls=True, lang="en", det_limit_side_len=10_000, det_db_score_mode="slow", enable_mlkdnn=True,)
5 unmodified lines image_np = np.array(image)
if ocr_engine == PADDLE_OCR_LABEL: ocr_result = OCR.ocr(image_np)[0] ocr_result = OCR.ocr(image_np, cls=False)[0] words = [x[1][0] for x in ocr_result] boxes = np.asarray([x[0] for x in ocr_result]) # (n_boxes, 4, 2)
app.py+1-3