docquery / app.py
abidlabs's picture
abidlabs HF staff
Update app.py
e3f45be
raw
history blame
No virus
386 Bytes
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
)
print(prediction)
return prediction['answer']
gr.Interface(predict, [gr.Image(type="filepath"), gr.Textbox(label="Question")], gr.Textbox()).launch()