How mohamedbr-dev/arabic-sentiment-analysis works
This repository builds and serves a three-class Arabic sentiment classifier. Its main workflow prepares labeled data, fine-tunes AraBERT, merges two trained models, and serves predictions through FastAPI; evaluation and an in-browser ONNX demo are additional product capabilities. The graph also shows shared text cleaning and request limiting. Some links reflect explicit README descriptions; unsampled implementation details are not inferred.
Main entry points: day3_api.py FastAPI endpoints · day1_arabic_sentiment.py Dataset preparation · day2_finetune_arabert.py AraBERT fine-tuning · index.html Static demo page
Components 20
Data Preparation
- Dataset preparation
src/day1_arabic_sentiment.py - Review labels
src/review_data.py - Text cleaning
src/text_clean.py
Model Development
- AraBERT fine-tuning
src/day2_finetune_arabert.py - Trained model variants
- Model weight merge
src/merge_models.py - Served model
- Model evaluation
src/evaluate.py
API Serving
- FastAPI endpoints
src/day3_api.py - Request limiter
src/rate_limit.py - Interactive API page
src/static/index.html
Browser Demo
- ONNX export
deploy/export_onnx.py - Browser inference
deploy/static/model.js - Browser text cleaning
deploy/static/text_clean.js - Static demo page
deploy/static/index.html - Quantized ONNX model
deploy/export_onnx.py
Other components
- Data / model user
- Hugging Face
- Labeled datasets
- API / demo visitor
Connections 29
- Data / model user → Dataset preparation: runs preparation
README.md - Hugging Face → Dataset preparation: provides ArSAS
README.md - Hugging Face → Review labels: provides reviews
src/review_data.py - Dataset preparation → Review labels: loads review sources
src/day1_arabic_sentiment.py - Dataset preparation → Text cleaning: cleans text
src/day1_arabic_sentiment.py - Dataset preparation → Labeled datasets: writes splits
README.md - Labeled datasets → AraBERT fine-tuning: supplies splits
README.md - Data / model user → AraBERT fine-tuning: runs fine-tuning
README.md - AraBERT fine-tuning → Text cleaning: uses cleaning
src/day2_finetune_arabert.py - Hugging Face → AraBERT fine-tuning: provides base model
README.md - AraBERT fine-tuning → Trained model variants: saves checkpoints
README.md - Data / model user → Model weight merge: runs merge
README.md - Trained model variants → Model weight merge: provides weights
README.md - Model weight merge → Served model: writes merged weights
README.md - Data / model user → Model evaluation: runs scoring
README.md - Trained model variants → Model evaluation: provides candidates
README.md - Served model → Model evaluation: provides model
README.md - API / demo visitor → FastAPI endpoints: sends predictions
README.md - FastAPI endpoints → Served model: loads model
src/day3_api.py - FastAPI endpoints → Text cleaning: cleans requests
src/day3_api.py - FastAPI endpoints → Request limiter: checks request rate
src/day3_api.py - FastAPI endpoints → Interactive API page: serves page
src/day3_api.py - Data / model user → ONNX export: runs export
README.md - Served model → ONNX export: provides source model
README.md - ONNX export → Quantized ONNX model: writes quantized model
deploy/export_onnx.py - API / demo visitor → Static demo page: opens demo
README.md - Static demo page → Browser inference: runs inference
README.md - Static demo page → Browser text cleaning: cleans input
README.md - Browser inference → Quantized ONNX model: loads model
deploy/static/model.js