Spaces:
Runtime error
Runtime error
Joyantac33
commited on
Commit
•
370add3
1
Parent(s):
a0166a9
Update app.py
Browse files
app.py
CHANGED
@@ -37,8 +37,12 @@ def process_document(image, question):
|
|
37 |
sequence = processor.batch_decode(outputs.sequences)[0]
|
38 |
sequence = sequence.replace(processor.tokenizer.eos_token, "").replace(processor.tokenizer.pad_token, "")
|
39 |
sequence = re.sub(r"<.*?>", "", sequence, count=1).strip() # remove first task start token
|
|
|
|
|
|
|
40 |
|
41 |
-
return
|
|
|
42 |
|
43 |
description = "Gradio Demo for Donut, an instance of `VisionEncoderDecoderModel` fine-tuned on DocVQA (document visual question answering). To use it, simply upload your image and type a question and click 'submit', or click one of the examples to load them. Read more at the links below."
|
44 |
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>"
|
|
|
37 |
sequence = processor.batch_decode(outputs.sequences)[0]
|
38 |
sequence = sequence.replace(processor.tokenizer.eos_token, "").replace(processor.tokenizer.pad_token, "")
|
39 |
sequence = re.sub(r"<.*?>", "", sequence, count=1).strip() # remove first task start token
|
40 |
+
|
41 |
+
json_content = processor.token2json(sequence)
|
42 |
+
print(json_content) # Print the full JSON content
|
43 |
|
44 |
+
return json_content
|
45 |
+
#return processor.token2json(sequence)
|
46 |
|
47 |
description = "Gradio Demo for Donut, an instance of `VisionEncoderDecoderModel` fine-tuned on DocVQA (document visual question answering). To use it, simply upload your image and type a question and click 'submit', or click one of the examples to load them. Read more at the links below."
|
48 |
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>"
|