docquery / app.py
abidlabs's picture
abidlabs HF staff
Create app.py
2a2bd59
raw
history blame
336 Bytes
import gradio as gr
from transformers import pipeline
nlp = pipeline(
"document-question-answering",
model="impira/layoutlm-document-qa",
)
def predict(img, text):
return nlp(
img,
text
)['answer']
gr.Interface(predict, [gr.Image(type="filepath"), gr.Textbox(label="Question")], gr.Textbox()).launch()