Update app.py
Browse files
app.py
CHANGED
@@ -4,8 +4,8 @@ import gradio as gr
|
|
4 |
import torch
|
5 |
from transformers import DonutProcessor, VisionEncoderDecoderModel
|
6 |
|
7 |
-
processor = DonutProcessor.from_pretrained("
|
8 |
-
model = VisionEncoderDecoderModel.from_pretrained("
|
9 |
|
10 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
11 |
model.to(device)
|
@@ -39,7 +39,7 @@ def process_document(image):
|
|
39 |
|
40 |
return processor.token2json(sequence)
|
41 |
|
42 |
-
description = "Gradio Demo for Donut, an instance of `VisionEncoderDecoderModel` fine-tuned on
|
43 |
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2111.15664' target='_blank'>Donut: OCR-free Document Understanding Transformer</a> | <a href='https://github.com/clovaai/donut' target='_blank'>Github Repo</a></p>"
|
44 |
|
45 |
demo = gr.Interface(
|
|
|
4 |
import torch
|
5 |
from transformers import DonutProcessor, VisionEncoderDecoderModel
|
6 |
|
7 |
+
processor = DonutProcessor.from_pretrained("./donut-base-finetuned-inv")
|
8 |
+
model = VisionEncoderDecoderModel.from_pretrained("./donut-base-finetuned-inv")
|
9 |
|
10 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
11 |
model.to(device)
|
|
|
39 |
|
40 |
return processor.token2json(sequence)
|
41 |
|
42 |
+
description = "Gradio Demo for Donut, an instance of `VisionEncoderDecoderModel` fine-tuned on Invoices. To use it, simply upload your image and click 'submit', or click one of the examples to load them. Read more at the links below."
|
43 |
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2111.15664' target='_blank'>Donut: OCR-free Document Understanding Transformer</a> | <a href='https://github.com/clovaai/donut' target='_blank'>Github Repo</a></p>"
|
44 |
|
45 |
demo = gr.Interface(
|