Update app.py
Browse files
app.py
CHANGED
|
@@ -26,6 +26,9 @@ 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")
|
|
|
|
|
|
|
|
|
|
| 29 |
# define id2label, label2color
|
| 30 |
labels = dataset.features['ner_tags'].feature.names
|
| 31 |
id2label = {v: k for v, k in enumerate(labels)}
|
|
@@ -76,9 +79,10 @@ def process_image(image):
|
|
| 76 |
|
| 77 |
|
| 78 |
title = "Interactive demo: Invoice Extraction & Categorization"
|
| 79 |
-
description = "Text extracted and annotated QUESTION/ANSWER/HEADER/OTHER.
|
| 80 |
|
| 81 |
examples =[['document.png']]
|
|
|
|
| 82 |
|
| 83 |
css = ".output-image, .input-image {height: 40rem !important; width: 100% !important;}"
|
| 84 |
#css = "@media screen and (max-width: 600px) { .output_image, .input_image {height:20rem !important; width: 100% !important;} }"
|
|
|
|
| 26 |
image = Image.open(dataset[0]["image_path"]).convert("RGB")
|
| 27 |
image = Image.open("./invoice.png")
|
| 28 |
image.save("document.png")
|
| 29 |
+
Image.open("./invoice2.png").convert("RGB").save("document1.png")
|
| 30 |
+
Image.open("./invoice3.png").convert("RGB").save("document2.png")
|
| 31 |
+
|
| 32 |
# define id2label, label2color
|
| 33 |
labels = dataset.features['ner_tags'].feature.names
|
| 34 |
id2label = {v: k for v, k in enumerate(labels)}
|
|
|
|
| 79 |
|
| 80 |
|
| 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;} }"
|