Spaces:
Runtime error
Runtime error
| import streamlit as st | |
| from transformers import pipeline | |
| from PIL import Image | |
| nlp = pipeline( | |
| "document-question-answering", | |
| model="impira/layoutlm-document-qa", | |
| ) | |
| st.title("DocVPA Demo") | |
| file_name = st.file_uploader("Upload a document/image(.pdf, .png, .jpeg, .jpg)") | |
| question = st.text_input("Write your question regarding to your document") | |
| if file_name is not None: | |
| col1, col2 = st.columns(2) | |
| image = Image.open(file_name) | |
| col1.image(image, use_column_width=True) | |
| if st.button("Send"): | |
| predictions = nlp(image, question) | |
| st.write(predictions) |