This application, built using Streamlit, leverages the capabilities of GPT-3.5 to interactively answer questions based on the contents of a PDF document. Users can upload a PDF, and the application extracts its text, which can then be used as context for asking questions.
- Python 3.x
- Streamlit
- PyPDF2
- OpenAI API Key
To set up this application, follow these steps:
- Clone this repository to your local machine.
- Install the required Python packages using
pip
:pip install streamlit PyPDF2 openai
- You'll need an API key from OpenAI. Sign up at OpenAI's website and get your API key.
- After obtaining the OpenAI API key, create a
secrets.toml
file in your project directory. - Add the following content to the
secrets.toml
file, replacingyour_api_key
with your actual API key:api_key = "your_api_key"
To run the application, execute the following command in your project directory:
streamlit run app.py
After starting the application:
- Upload a PDF file using the provided interface.
- Once the PDF is uploaded, it will be processed to extract the text.
- Enter a question in the text box provided.
- The application will use the extracted text as context to provide answers using OpenAI's GPT-3.5 model.