CoolFace
Apppublic

TORR3S/musicrate-content-moderation-ml

sourceHugging Faceupdated 11mo agoView on Hugging Face
0likes
App README

Content Moderation ML Microservice

A FastAPI-based machine learning microservice for content moderation of music album reviews. This service uses transformer models to detect toxic content and spam in Spanish text.

Features

  • Toxicity Detection: Identifies hate speech and offensive language
  • Spam Detection: Detects promotional and irrelevant content
  • Fast API: RESTful API with automatic documentation
  • Docker Ready: Containerized for easy deployment
  • Batch Processing: Process multiple reviews at once

Quick Start

Visit the API Documentation to test the service interactively.

Example Usage

bash
curl -X POST "https://YOUR_SPACE_URL/classify" \
  -H "Content-Type: application/json" \
  -d '{"text": "Este álbum es increíble"}'

API Endpoints

  • POST /classify - Classify a single review
  • POST /classify/batch - Classify multiple reviews
  • GET /health - Service health status
  • GET /docs - Interactive API documentation

Models Used

  • Toxicity: bgonzalezbustamante/bert-spanish-toxicity
  • Spam: asfilcnx3/spam-detection-es

Configuration

The service works out of the box with sensible defaults. Optional environment variables:

  • TOXIC_THRESHOLD (default: 0.7)
  • SPAM_THRESHOLD (default: 0.7)
  • MAX_BATCH_SIZE (default: 50)

Response Format

json
{
  "toxicity": {
    "label": "NON_TOXIC",
    "score_toxic": 0.12,
    "score_non_toxic": 0.88,
    "confidence": 0.88
  },
  "spam": {
    "label": "NOT_SPAM",
    "score_spam": 0.08,
    "score_not_spam": 0.92,
    "confidence": 0.92
  },
  "recommendation": "KEEP",
  "should_be_removed": false
}

GitHub Repository

View full documentation and source code