How adonpm/spam-detection-app works
Project type and purpose
• This is a full-stack, containerized web application for real-time spam detection.
• The frontend is a simple HTML/Jinja2 interface served by FastAPI; the backend is a REST API that loads a pre-trained NLP/ML pipeline (CountVectorizer + RandomForest) to classify messages.
File structure
• Top-level:
• Dockerfile + GitHub Actions workflow → containerization and CI/CD
• app.py → FastAPI server entry point
• requirements.txt → Python dependencies
• Core directories:
• templates/ → Jinja2 HTML views
• static/css/ → styling assets
• cv/ → serialized CountVectorizer
• models/ → serialized RandomForest model
• nltk_data/ → tokenizers & stopword corpora
• data/ → raw SMS dataset (used offline/training)
• notebooks/ → experimentation & model training
• No traditional database; the “model files” act as persisted ML assets.
README for additional insights
• Confirms architecture: FastAPI REST endpoints (“/” and “/predict”), NLTK preprocessing, scikit-learn pipeline, Docker container, deployment on Hugging Face Spaces.
• No external DB or message queue; compute is in-process.
Diagramming suggestions
• Use rectangles or clouds for components:
• Client Browser (User)
• FastAPI Service
• Preprocessing Module
• Vectorizer & Model (grouped or separate)
• File System (nltk_data, cv, models)
• CI/CD pipeline and Deployment
• “HTTP GET/POST” between client and server
• “Load” at startup between server and pickle files
• “Tokenize → Vectorize → Predict” within the ML pipeline
• Green for frontend elements
• Blue for backend/API
• Orange for ML components
• Grey for external/deployment services
Key points to capture
• Startup sequence: loading models & data
• Request flow through preprocessing & classification
• Absence of a traditional database (model files instead)
• Container + CI/CD integration