Skip to content

stong/bad-tweet-firewall

Repository files navigation

Bad Tweet Firewall

Highlights bad tweets in a big red border. You train your personal algorithm to decide what tweets get highlighted.

The idea is that negative emotions from your feed generally harm your mental health. Meanwhile, most tweets are just honestly not that valuable. So let's make a firewall to just filter out posts with bad attitude and vibes.

Examples

These are all examples from my personal curated algorithm. You can train the extension to filter whatever you want. Note that I do not have any beef with the particular posters I just don't like seeing negative things on my timeline because they make me sad.

Political content:

image

Unsavory celebrity gossip with negative sentiment:

image

Negative sentiment hot takes:

image

Commercial announcements:

image

image

AGI doomposting

image

Engagement bait

image

general Doomposting

image

How does it work?

Inference: Tweet username + content -> OpenAI text-embedding-3-small -> 256 dimensions embedding -> binary classifier

Data: It puts all the shit into IndexedDB on x.com Lol

Training: Piece of shit training script (see train.py)

How to personalize (train) your own algorithm instructions

Extension lets you label tweets as bad or neutral. Then you save this data and rerun the training script.

  1. populate Source/api-key.js with: const OPENAI_API_KEY = 'sk-proj-...';
  2. Install the extension, go on the timeline
  3. To mark a tweet as bad, hover the tweet and press "1" on keyboard
  4. To mark a tweet as always safe, hover the tweet and press "2" on keyboard
  5. To mark a tweet as safe, hover the tweet and press "0" on the keyboard
  6. You can also press "3" to inspect the score of the hovered tweet
  7. Unmarked tweets are default to safe
  8. Extract training data: copy paste contents of helper.js into js console on x.com
  9. Copy downloaded files into this directory
  10. populate .env with OPENAI_API_KEY=...
  11. Run embed.py to (re-)compute embeddings with openai. If you add more training data later, it will not recompute embedding you already have
  12. Run train.py to produce a pytorch model
  13. Run export-model-to-onnx.py to convert pytorch model to ONNX and place it in browser extension folder (Source/)
  14. Reload the browser extension, now you have loaded the newly trained model

About

Chrome extension that highlights unwanted tweets

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published