This Python script allows you to interact with a GPT-3.5-turbo model by OpenAI to analyze and summarize articles from URLs. You can ask questions about the article, and the model will answer based on the content. The script uses the newspaper3k
library to extract the article content and the OpenAI API to communicate with the GPT-3.5-turbo model.
- Extracts article content from a given URL
- Splits the article into smaller parts if needed
- Summarizes the article upon request
- Allows the user to ask questions about the article
- Interacts with the GPT-3.5-turbo model via the OpenAI API
- Clone the repository:
This Python script allows you to interact with a GPT-3.5-turbo model by OpenAI to analyze and summarize articles from URLs. You can ask questions about the article, and the model will answer based on the content. The script uses the newspaper3k
library to extract the article content and the OpenAI API to communicate with the GPT-3.5-turbo model.
- Extracts article content from a given URL
- Splits the article into smaller parts if needed
- Summarizes the article upon request
- Allows the user to ask questions about the article
- Interacts with the GPT-3.5-turbo model via the OpenAI API
- Clone the repository:
git clone https://github.com/maximedotair/article_analysis_gpt.git
- Change to the project directory:
cd article-analysis-gpt
- Create a virtual environment and activate it:
python3 -m venv myenv source myenv/bin/activate
- Install the required packages:
$ pip install -r requirements.txt
- Add your OpenAI API key to the script:
Replace your_api_key_here
with your actual API key in the line:
api_key = "your_api_key_here"
Run the script:
$ python article_analysis.py
Enter the URL of the article to summarize: https://example.com/article-url
Choose to summarize the article or ask your own question:
Do you want to summarize the article? (yes/no): yes
Ask questions about the article:
Ask a question (previous questions and answers are not saved) or type 'exit' to quit: What is the main point of the article?
Type 'exit' to quit the script:
Ask a question (previous questions and answers are not saved) or type 'exit' to quit: exit
OpenAI - Python library for the OpenAI API newspaper3k - Python library for extracting and parsing newspaper articles
This project is licensed under the MIT License.