Update app.py
Browse files
app.py
CHANGED
|
@@ -17,8 +17,8 @@ from datasets import load_dataset
|
|
| 17 |
from PIL import Image, ImageDraw, ImageFont
|
| 18 |
|
| 19 |
processor = LayoutLMv2Processor.from_pretrained("microsoft/layoutlmv2-base-uncased")
|
| 20 |
-
|
| 21 |
-
model = LayoutLMv2ForTokenClassification.from_pretrained("mishtert/iec")
|
| 22 |
|
| 23 |
# load image example
|
| 24 |
#dataset = load_dataset("nielsr/funsd", split="test")
|
|
@@ -81,8 +81,8 @@ def process_image(image):
|
|
| 81 |
title = "Interactive demo: Invoice Extraction & Categorization"
|
| 82 |
description = "Text extracted and annotated QUESTION/ANSWER/HEADER/OTHER."
|
| 83 |
|
| 84 |
-
examples =[['document.png']]
|
| 85 |
-
|
| 86 |
|
| 87 |
css = ".output-image, .input-image {height: 40rem !important; width: 100% !important;}"
|
| 88 |
#css = "@media screen and (max-width: 600px) { .output_image, .input_image {height:20rem !important; width: 100% !important;} }"
|
|
|
|
| 17 |
from PIL import Image, ImageDraw, ImageFont
|
| 18 |
|
| 19 |
processor = LayoutLMv2Processor.from_pretrained("microsoft/layoutlmv2-base-uncased")
|
| 20 |
+
model = LayoutLMv2ForTokenClassification.from_pretrained("nielsr/layoutlmv2-finetuned-funsd")
|
| 21 |
+
#model = LayoutLMv2ForTokenClassification.from_pretrained("mishtert/iec")
|
| 22 |
|
| 23 |
# load image example
|
| 24 |
#dataset = load_dataset("nielsr/funsd", split="test")
|
|
|
|
| 81 |
title = "Interactive demo: Invoice Extraction & Categorization"
|
| 82 |
description = "Text extracted and annotated QUESTION/ANSWER/HEADER/OTHER."
|
| 83 |
|
| 84 |
+
#examples =[['document.png']]
|
| 85 |
+
examples =[['document.png'],['invoice2.png'],['invoice3.png']]
|
| 86 |
|
| 87 |
css = ".output-image, .input-image {height: 40rem !important; width: 100% !important;}"
|
| 88 |
#css = "@media screen and (max-width: 600px) { .output_image, .input_image {height:20rem !important; width: 100% !important;} }"
|