# Swahili SMS Spam Detection
## Project Overview
This project implements an end-to-end machine learning pipeline for detecting spam in Swahili text messages. It uses the LaBSE (Language-agnostic BERT Sentence Embeddings) model for text embedding and a binary classifier for spam detection.
### Key Features
- Multilingual text processing using LaBSE
- FastAPI-based REST API for real-time predictions
- MLflow for experiment tracking and model versioning
- DVC for data and model versioning
- Docker support for containerized deployment
- Modular architecture following clean code principles
## Getting Started
### Prerequisites
- Python 3.10
- Conda (recommended for environment management)
- Git LFS (for model files)
### Installation
1. Clone the repository:
```bash
git clone
github.com
cd Swahili-SMS-Spam-Detection
```
2. Create and activate conda environment:
```bash
conda create -n swahili_spam python=3.10
conda activate swahili_spam
```
3. Install dependencies:
```bash
pip install -r requirements.txt
```
### Running the Application
1. **Local Development**:
```bash
uvicorn app:app --reload
```
2. **Docker Deployment**:
```bash
docker build -t swahili-spam-detector .
docker run -p 8000:8000 swahili-spam-detector
```
3. **View MLFlow Experiments**:
```bash
mlflow server --host 127.0.0.1 --port 8080
```
## Technical Architecture
### Components
1. **Data Processing Pipeline**
- Handles data ingestion and preprocessing
- Generates embeddings using LaBSE model
- Manages train-test splitting
2. **Model Pipeline**
- Trains binary classifier on embeddings
- Performs model evaluation
- Logs metrics and artifacts to MLflow
3. **API Service**
- FastAPI-based REST endpoint
- Real-time prediction serving
- Model loading and management
### Directory Structure
```
├── artifacts/ # Generated artifacts (data, models)
├── config/ # Configuration files
├── model/ # Saved models
├── note …