/hackrecap

HackRecap is a Python project that summarizes top stories from Hacker News using OpenAI's text-davinci-03 model and displays them in a paginated list on a Flask web app.

Primary LanguagePythonMIT LicenseMIT

HackRecap

HackRecap is a Python project that fetches the top stories from Hacker News, fetches their text content from the original webpage, and summarizes them using OpenAI's text-davinci-03 model. The summarized stories are then displayed in a paginated list on a Flask web app.

Requirements

Docker, or Python 3.11 and Redis if running without Docker

Getting started

To get started, follow these steps:

  1. Clone this repository:

    git clone https://github.com/kixpanganiban/hackrecap.git

  2. Navigate to the project directory:

    cd hackrecap

  3. Build the Docker images:

    docker compose build

  4. Start the Docker containers:

    docker compose up

  5. Run the summarizer:

    OPENAI_KEY=xxx docker compose exec web python summarizer.py

  6. Open your web browser and go to http://localhost:8888.

Routes

  • / index page which returns the HTML version of the summarized stories
  • /api/stories a JSON endpoint that accepts limit and offset, returning the summarized stories and their metadata

Configuration

The following environment variables need to be set to configure the app:

  • OPENAI_KEY: Your OpenAI API key (required to use the app).

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments