Rewrite headlines from news organizations to change the positive/negative sentiment. Hosted at https://makeheadlines.gerardkeiser.com.
Make Headlines pulls in headlines from the RSS feeds of news providers (currently just The New York Times and The Wall Street Journal) and analyzes them with sentiment model. On the main page it shows visitors a single random headline along with the sentiment (positive or negative) and the certainty score. The visitor can then write new wording for the headline and try to change the sentiment, or at least the certainty.
Anonymous users are limited to ten rewrite attempts; to continue they must create a login, which will let them view all of their previous rewrite attempts.
The server is written in Python with Flask, tested with pytest, and uses a PostgreSQL database; the frontend uses Sass and TypeScript.
For sentiment analysis this uses the Python Flair library and the default model.
Note that Flair pulls in a very large number of dependencies, and the model itself is quite large. The Docker image is about 3.3GB, and expect it to take more than 1GB of RAM when pulling in more headlines, and ~650MB idling.
- Set environment variables in
docker-compose.yml
docker compose up
docker exec sentimental-headlines-web-1 python3 -m server.seed
(Pulls in initial headlines. If left running, it will pull in more every three hours.)- Served at localhost:5000. It must be changed in both
gunicorn.config.py
anddocker-compose.yml
.
If you want to build it yourself, download the very large sentiment model, or some other model, to server/models/
. (It will otherwise download it automatically, but you will have to do that every time you build a docker image.)
- Install dependencies and add database (default name is
headlines_test
) python3 -m server.seed
(When run this way, it will fully reset the database.)flask run
- [x] Regularly re-run seed headlines function
- [x] User validations
- [x] About page
- [ ] Code cleanup
- [ ] Remove unused imports, commented code, etc
- [ ] Remove all implicit any from TypeScript
- [ ] Test frontend (Cypress?)
- [ ] More tests, as always
- [ ] Flair pulls in dozens of dependencies, most of the unnecessary. Remove them from production, if possible
- [ ] UX improvements
- [x] Add more description/style to the user results
- [x] Make layout responsive
- [x] Handle failed request to /api/rewrites gracefully on the frontend
- [x] Implement better view for showing that a request failed
- [ ] Add cookie notification
- [ ] Add alternative login systems (Google, Github, crypto, etc)
- [x] Let user see all rewrites
- [ ] Password recovery
- [x] Profile page with edit features
- [x] Password editing
- [ ] Search functionality
- [ ] Add more rewrites to old headlines
- [ ] Interesting features
- [ ] Calculate semantic match
- [ ] More news sources
- [x] Default main page to only showing recent headlines
- [ ] Show average daily sentiment