This is a web application built with Python and Flask that allows users to upload a PDF file and receive a simplified, humorous explanation of the contents using OpenAI's GPT-3 API. The application uses NLTK to split the PDF text into smaller chunks to stay within the API's maximum token limit, and PyPDF2 to extract the text from the PDF file.
To run this application, you will need:
- Python 3.6 or later
- An OpenAI API key
- Clone this repository to your local machine.
- Install the required packages using pip:
pip install -r requirements.txt
- Set your OpenAI API key as an environment variable:
export OPENAI_API_KEY=your-api-key-here
You can find the frontend code for this project at the following link: https://github.com/sumitra19jha/PDF-Converter-React-Frontend
Make sure to follow the instructions in the frontend README.md file to set up and run the application.
- Start the Flask server:
python app.py
- Navigate to frontend(
http://localhost:3000
) in your web browser. - Upload a PDF file, and provide a city and country to use in the explanation.
- Click "Submit" and wait for the GPT-3 API to generate a response.
- The response will be displayed on the right-hand side of the page, along with page numbers for multi-page PDFs.
This project is licensed under the MIT License. See the LICENSE file for details.