SmartCertify-ML / README.md
Harsh Yadav
feat: migrate to HF Spaces β€” ResNet-18 CNN + BERT + DistilBERT + tabular ensemble
8e68c3a
|
Raw
History Blame Contribute Delete
2 kB
metadata
title: SmartCertify ML
emoji: πŸŽ“
colorFrom: blue
colorTo: indigo
sdk: docker
pinned: false
license: mit
app_port: 7860

SmartCertify ML Microservice

FastAPI ML service for AI-powered certificate fraud detection.

Upgraded from Render (lightweight) β†’ Hugging Face Spaces (full models):

  • Image tampering: ResNet-18 CNN (fine-tuned) β€” NOT ELA stats
  • Similarity: BERT sentence-transformers (all-MiniLM-L6-v2) β€” NOT TF-IDF
  • Chat: DistilBERT zero-shot classification β€” NOT keyword matching

Endpoints

Method Path Description
GET /health Health check
POST /api/ml/verify Fraud detection β€” RF+XGB+LGB ensemble
POST /api/ml/analyze-image Tampering detection β€” ResNet-18 CNN
POST /api/ml/similarity Duplicate detection β€” BERT cosine
POST /api/ml/trust-score Issuer trust β€” Gradient Boosting
POST /api/ml/anomaly Anomaly detection β€” Isolation Forest
POST /api/ml/chat Q&A chatbot β€” DistilBERT zero-shot
POST /api/ml/recommend Course recs β€” BERT similarity
GET /api/ml/metrics Model metrics

Authentication

All endpoints require X-API-Key header. Set ML_API_KEY as a Space secret in HF settings.

Models

All trained at Docker build time (baked into image):

Model Type Size
Fraud detection RF + XGBoost + LightGBM ~15 MB
Image tampering ResNet-18 (fine-tuned, CPU) ~45 MB
Semantic similarity all-MiniLM-L6-v2 ~90 MB
Chat classification DistilBERT zero-shot ~66 MB
Trust scoring Gradient Boosting ~2 MB
Anomaly detection Isolation Forest ~1 MB

Local Development

docker build -t smartcertify-ml .
docker run -p 7860:7860 -e ML_API_KEY=dev-key smartcertify-ml
curl http://localhost:7860/health

Deploy to HF Spaces

git remote add hf https://huggingface.co/spaces/YOUR_USERNAME/SmartCertify-ML
git push hf main