This Streamlit application allows you to upload a PDF document, and then ask questions to retrieve relevant information from the document.
- Python 3.7 or higher
- Streamlit
- Required Python libraries listed in
requirements.txt
- Clone this repository to your local machine.
git clone https://github.com/franpandol/streamlit_openai_ask_pdf.git
- Navigate to the project directory.
cd your-repo
- Install the required Python libraries.
pip install -r requirements.txt
Create a .env
file in the project root directory to store your OpenAI API key. The contents of the file should be as follows:
OPENAI_API_KEY=your-api-key-here
Replace your-api-key-here
with your actual OpenAI API key.
To run the application, use the following command in the project root directory:
streamlit run app.py
This will launch the Streamlit server and open the application in your web browser. You can then upload a PDF document using the file uploader, and ask questions related to the document content in the provided text input field.
- Upload a PDF document to process its content.
- Ask questions to retrieve relevant information from the document.
- Lazy loading of resources for better performance.
- Error handling to ensure a smooth user experience.
If you encounter any issues while running the application, check the console for error messages. Ensure that your OpenAI API key is correct and that you have internet connectivity.
Feel free to fork this repository, make changes, and open a pull request if you think your changes are worth sharing.