This Streamlit application allows users to perform question answering on documents and images using the LayoutLM model. Users can upload a document or image file and ask specific questions related to the content. Additionally, prompt suggestions are available to help users formulate questions quickly.
-
Clone the repository:
git clone https://github.com/msnabiel/Layoutlm-document-QA.git cd Layoutlm-document-QA -
Install the required dependencies:
pip install -r requirements.txt
Make sure you have Python installed along with pip.
-
Run the Streamlit application:
streamlit run app.py
-
Access the application through the URL provided by Streamlit in your terminal.
-
Upload a document or image file (PDF, PNG, JPG, JPEG) using the file uploader.
-
Enter your question in the text input field.
-
Click the "Ask" button to submit your question and see the model's answer.
- File Upload: Supports uploading PDF, PNG, JPG, and JPEG files for document analysis.
- Question Input: Users can enter custom questions related to the uploaded document or image.
- Prompt Suggestions: Sidebar provides quick prompts to assist in formulating questions.
- Real-time Answering: Displays answers from the LayoutLM model with confidence scores.
- Error Handling: Provides error messages for unsupported file formats or processing issues.
Supported file formats for uploading:
- PDF files containing text or images.
- Image files (PNG, JPG, JPEG) of documents or screenshots.
- Unsupported File Formats: If you encounter an error stating "Unsupported file format," ensure you are uploading a supported file type.
- Model Errors: If the model encounters issues while processing the document or image, an error message will be displayed. Check the error details for troubleshooting steps.
Certainly! Adding licensing information and collaboration details to your README file is important for clarity on usage rights and potential contributions. Here’s an updated version of your README.md file that includes the MIT license and collaboration information:
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! If you would like to contribute to this project, please follow these steps:
- Fork the repository and create your branch (
git checkout -b feature/your-feature). - Make your changes and commit them (
git commit -am 'Add some feature'). - Push to the branch (
git push origin feature/your-feature). - Create a new Pull Request.
Please ensure your pull request adheres to the Contributor Covenant code of conduct.
- LayoutLM Model: Powered by Hugging Face Transformers library.
- Streamlit: Used for creating interactive and user-friendly web applications.