File size: 469 Bytes
6581de9
 
 
 
 
 
 
 
 
 
 
 
 
 
1d1c112
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import torch

from PIL import Image
from transformers import VisionEncoderDecoderModel, VisionEncoderDecoderConfig  # , DonutProcessor


def demo_process(input_img):
    global pretrained_model, task_prompt, task_name
    # input_img = Image.fromarray(input_img)
    output = pretrained_model.inference(image=input_img, prompt=task_prompt)["predictions"][0]
    return output

task_prompt = f"<s>"

st.text('This model is trained with receipt images -> SROIE dataset.')