Update app.py
Browse files
app.py
CHANGED
@@ -17,12 +17,12 @@ 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/Invoice_extraction_categorization")
|
22 |
|
23 |
# load image example
|
24 |
-
|
25 |
-
dataset = load_dataset("Mishtert/niefunsd", split="test")
|
26 |
image = Image.open(dataset[0]["image_path"]).convert("RGB")
|
27 |
image = Image.open("./invoice.png")
|
28 |
image.save("document.png")
|
|
|
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/Invoice_extraction_categorization")
|
22 |
|
23 |
# load image example
|
24 |
+
dataset = load_dataset("nielsr/funsd", split="test")
|
25 |
+
#dataset = load_dataset("Mishtert/niefunsd", split="test")
|
26 |
image = Image.open(dataset[0]["image_path"]).convert("RGB")
|
27 |
image = Image.open("./invoice.png")
|
28 |
image.save("document.png")
|