This project allows you to upload a PDF document and ask questions about its content. It uses LangChain, OpenAI Embeddings, GPT-4, and the Facebook AI Similarity Search (FAISS) library to process the text in the PDF and provide answers to questions related to the document.
-
Clone the repository:
git clone https://github.com/john-thuo1/chatWithPDF cd chatWithPDF
-
Create a Virtual Environment:
python -m venv env
-
Install the required dependencies:
pip install -r requirements.txt
-
Create an OpenAI API Key and add it to your
.env
file: OpenAI PlatformOPENAI_API_KEY="your-secret-key"
-
Run the application:
streamlit run App.py
-
Clone the repository:
git clone https://github.com/john-thuo1/chatWithPDF cd chatWithPDF
-
Build the Docker image:
First, ensure you have Docker installed and running on your system. Then, use the following command to build the image from the Dockerfile:
docker-compose build
-
Run the app with Docker:
After the build is complete, you can run the app in a container using Docker Compose:
docker-compose up
This will start the app and map port
8501
from the container to the host machine. The application will be available athttp://localhost:8501
. -
(Optional) Set up your OpenAI API Key:
If you're using Docker, you can set your OpenAI API Key using environment variables. Either:
- Use a
.env
file (uncomment theenv_file
section in thedocker-compose.yml
). - Alternatively, pass the environment variable manually at runtime:
OPENAI_API_KEY=your-secret-key
You can also store the OpenAI API key in your
.env
file and ensure the file is loaded with the Docker Compose configuration. - Use a