This project is a web-based application that allows users to upload documents and interact with them using AI-powered Q&A functionality. Users can ask both factual and contextual questions about the uploaded content and receive precise answers. The application supports document formats like PDFs and Excel files, providing an intuitive and user-friendly interface hosted on Streamlit.
- Users can upload documents in popular formats such as PDFs and Excel files.
- The application processes the uploaded file to extract readable content from both text-based and tabular formats.
- Users can ask questions about the uploaded document.
- The application leverages the Mistral language model for generating accurate and relevant answers.
- Supports both factual and contextual questions.
- Users can upload multiple documents and switch between them for querying.
- Each document is stored with its own vector embeddings for better retrieval.
- The web application is hosted on Streamlit.
- The Mistral model runs locally using Docker, exposed via Cloudflare Tunnel.
- All source code is maintained on a GitHub repository.
- The repository includes clear commit logs and adheres to good coding practices.
- Frontend:
- Built with Streamlit for a responsive and user-friendly interface.
- Backend:
- Powered by the Mistral language model running in a Docker container.
- Cloudflare Tunnel is used to expose the locally running Docker container to the public web.
- Q&A Engine:
- Parses document content and uses the AI model for answering user queries.
- Document Parsing:
- Processes PDF files to extract structured text.
- Reads Excel files, converting sheets into text for AI analysis.
- Python (3.9+)
- Docker
- Cloudflare CLI (
cloudflared) - Git
-
Clone the Repository:
git clone https://github.com/sidmittal32/pdf-chat.git cd pdf-chat -
Set Up the Environment:
- Create a virtual environment:
python -m venv env source env/bin/activate # On Windows: env\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Create a virtual environment:
-
Run the Docker Container:
- Pull and run the Docker container for the Mistral model:
docker run -d -p 11434:11434 mistral-docker-image
- Pull and run the Docker container for the Mistral model:
-
Expose Docker via Cloudflare Tunnel:
- Start a Cloudflare Tunnel:
cloudflared tunnel --url http://localhost:11434
- Note the public URL provided by Cloudflare and update your application code accordingly.
- Start a Cloudflare Tunnel:
-
Run the Streamlit App:
streamlit run app.py
-
Access the App:
- Open the Streamlit app in your browser using the provided URL (e.g.,
http://localhost:8501).
- Open the Streamlit app in your browser using the provided URL (e.g.,
📁 pdf-chat
├── 📁 files # Uploaded documents storage
├── 📁 jj # Chroma vector store (optional)
├── 📜 app.py # Main Streamlit application
├── 📜 Dockerfile # Docker configuration for the Mistral model
├── 📜 requirements.txt # Python dependencies
├── 📜 README.md # Project documentation
- Backend:
- Python (3.9+)
- Mistral model (running in Docker)
- Frontend:
- Streamlit
- Hosting:
- Cloudflare Tunnel (for exposing Docker container)
- Libraries:
- Streamlit
- LangChain
- ChromaDB
- DuckDB
- PyPDF
- Pandas (for Excel processing)
- Fork the repository.
- Create a feature branch.
- Submit a pull request with detailed commit messages.
- AI Model: Mistral
- Deployment: Streamlit, Docker, and Cloudflare Tunnel
- Document Parsing: Python libraries (LangChain, ChromaDB, Pandas)
This project is licensed under the MIT License. See the LICENSE file for more details.