Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -19,7 +19,8 @@ from PIL import Image, ImageDraw, ImageFont
|
|
19 |
|
20 |
|
21 |
processor = AutoProcessor.from_pretrained("microsoft/layoutlmv3-base", apply_ocr=True)
|
22 |
-
model = AutoModelForTokenClassification.from_pretrained("Theivaprakasham/layoutlmv3-finetuned-invoice")
|
|
|
23 |
|
24 |
|
25 |
|
@@ -66,7 +67,7 @@ def process_image(image):
|
|
66 |
width, height = image.size
|
67 |
|
68 |
# encode
|
69 |
-
encoding = processor(image, truncation=
|
70 |
offset_mapping = encoding.pop('offset_mapping')
|
71 |
|
72 |
# forward pass
|
|
|
19 |
|
20 |
|
21 |
processor = AutoProcessor.from_pretrained("microsoft/layoutlmv3-base", apply_ocr=True)
|
22 |
+
#model = AutoModelForTokenClassification.from_pretrained("Theivaprakasham/layoutlmv3-finetuned-invoice")
|
23 |
+
model = AutoModelForTokenClassification.from_pretrained("SickBoy/layoutlm_documents")
|
24 |
|
25 |
|
26 |
|
|
|
67 |
width, height = image.size
|
68 |
|
69 |
# encode
|
70 |
+
encoding = processor(image, truncation=True, return_offsets_mapping=True, return_tensors="pt")
|
71 |
offset_mapping = encoding.pop('offset_mapping')
|
72 |
|
73 |
# forward pass
|