File size: 367 Bytes
2a2bd59 e3f45be 2a2bd59 e3f45be 8c9c6ab 2a2bd59 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
import gradio as gr
from transformers import pipeline
nlp = pipeline(
"document-question-answering",
model="impira/layoutlm-document-qa",
)
def predict(img, text):
prediction = nlp(
img,
text
)
return prediction[0]['answer']
gr.Interface(predict, [gr.Image(type="filepath"), gr.Textbox(label="Question")], gr.Textbox()).launch() |