This project is a mini-app built on Modal that uses Anthropic’s Claude to detect and flag potentially harmful eating-disorder–related captions (e.g. TikTok, Reels, or other social posts).
It builds upon my more extensive college research on semi supervised transfer learning for eating disorder sentiment analysis: Transfer Learning for Eating Disorder Sentiment Analysis
The endpoint returns short, supportive warnings similar to the overlays you might see on TikTok, designed to protect viewers and encourage recovery-minded messaging.
-
Claude-powered classification
Uses Anthropic’s Claude 3 Haiku to classify captions asharmful,neutral, orsupportive. -
Short supportive warnings
Returns a very short viewer-facing message (≤15 words), like TikTok’s “This content may promote eating disorders.” -
Autoscaling on Modal
Deployed as a Modal web function with automatic scaling. Bursty traffic (hundreds of requests) spins up new containers, then scales back down. -
Swagger API docs
Comes with an auto-generated/docspage for quick testing in the browser.
- Modal — serverless infra for Python, autoscaling functions
- Anthropic Claude 3 Haiku — LLM inference
- FastAPI — powering the endpoint & docs
modal deploy app.pyThis creates a web endpoint at a URL like:
https://christineastoria--ed-sentiment-warnings-predict-and-recommend.modal.run/
curl -X POST "https://christineastoria--ed-sentiment-warnings-predict-and-recommend.modal.run/" -H "Content-Type: application/json" -d '{"text": "How to not feel like a whale today"}'{
"label": "harmful",
"rationale": "The caption expresses negative body image.",
"recommendation_for_viewer": "This content may promote eating disorders"
}Visit:
https://christineastoria--ed-sentiment-warnings-predict-and-recommend.modal.run/docs
to test via Swagger UI.
To simulate burst traffic, you can send multiple requests:
export URL="https://christineastoria--ed-sentiment-warnings-predict-and-recommend.modal.run/"
export BODY='{"text":"I feel like a whale today"}'
seq 1 200 | xargs -I{} -P 20 curl -s -X POST "$URL" -H "Content-Type: application/json" -d "$BODY" >/dev/nullWatch Modal’s dashboard to see containers spin up and scale back down automatically.
functions/ed_sentiment_analysis/app.py # Modal app definition + Claude integration
README.me # Project overview and usage
- Frontend demo page (instead of Swagger JSON)
- More nuanced labels (e.g.
triggering,educational,recovery-focused) - Support for batch analysis of captions
- Add observability (logging, metrics dashboards)
This project demonstrates how AI infra (Modal) and safe-by-design LLMs (Claude) can be combined to solve a real, sensitive problem: harmful eating disorder content online.
Instead of a toy demo, it focuses on responsible AI use, short warnings, and developer experience.