Skip to content

manuelm1209/news-summarizer-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

News Summarizer AI

News Summarizer AI is a Python-based application designed to fetch and summarize news articles on a specific topic using the OpenAI GPT model and the NewsAPI. The application leverages Streamlit for its user interface, making it easy to interact with.

Features

  • Fetch News Articles: Retrieve news articles from NewsAPI based on a topic.
  • Summarize News: Use OpenAI's GPT model to create concise summaries of the retrieved news articles.
  • Streamlit Integration: An interactive user interface for input and displaying results.

Prerequisites

Before you can run the project, ensure you have the following installed:

Installation

  1. Clone the repository:

    git clone https://github.com/your-username/news-summarizer-AI.git
    cd news-summarizer-AI
  2. Set up a virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install dependencies:

    pip install -r requirements.txt
  4. Set up environment variables:

    • Create a .env file in the root directory.
    • Add your API keys:
      NEWS_API_KEY=your_newsapi_key
      OPENAI_API_KEY=your_openai_api_key
      

Usage

  1. Run the application:

    streamlit run main.py
  2. Open the application in your browser at http://localhost:8501.

  3. Enter a topic in the input field and click Run Assistant to generate summaries for the latest news on that topic.

Project Structure

.
├── main.py               # Main application file
├── requirements.txt      # Project dependencies
├── .env                  # Environment variables (not included in the repo)
├── README.md             # Project documentation

How It Works

  1. Fetching News:

    • The get_news function queries the NewsAPI for articles based on the user's topic.
    • Retrieves up to 5 articles and their metadata.
  2. Summarizing News:

    • The AssistantManager class interacts with OpenAI's GPT API.
    • A personal assistant is created to process and summarize the news articles.
  3. Interactive Interface:

    • Users can interact with the app via a Streamlit-powered UI.

Dependencies

  • openai
  • streamlit
  • python-dotenv
  • requests

Install all dependencies using:

pip install -r requirements.txt

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any feature requests or bug fixes.

License

This project is licensed under the MIT License.

Acknowledgments

  • OpenAI for their powerful GPT model.
  • NewsAPI for providing a robust news aggregation service.
  • Streamlit for making web app development simple and intuitive.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages