Skip to content

framonmar7/content-moderation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧠 Content Moderation API

This project is a RESTful API for automated moderation of user-generated content. It performs binary classification of text input to detect toxic language, insults, and hate speech.

🔬 Models

The API delegates inference to hosted models on Hugging Face Inference Endpoints. Each classifier is optimized for a specific moderation task:

All models are finetuned on labeled datasets and are intended to be used as modular components of the moderation pipeline.


📚 Swagger Documentation

Interactive API documentation is automatically generated via Swagger UI and available at:

/docs/

Each endpoint accepts a POST request with a JSON body containing a single text field.

Example:

{
  "text": "You're worthless and stupid."
}

The response includes a label and a score (confidence).


⚙️ Setup Instructions

  1. Install the dependencies in a virtual environment:
python -m venv venv
source venv/bin/activate    # or .\venv\Scripts\activate on Windows
pip install -r requirements.txt
  1. Create your environment file:

Copy the .env.example to .env and provide the values:

DJANGO_SECRET_KEY=your-secret-key
DJANGO_DEBUG=True
DJANGO_ALLOWED_HOSTS=localhost,127.0.0.1
  1. Prepare the backend:
python manage.py migrate
python manage.py collectstatic --noinput
  1. Run the development server:
python manage.py runserver

Once the development server is running, you can access the application in your browser at the URL shown in the terminal.


🚦 Rate Limiting

To prevent abuse, the API uses django-ratelimit to limit excessive requests. Requests exceeding the threshold will receive HTTP 429 responses.


📜 License

This project is released under the MIT License.
You are free to use, modify, and distribute it — with attribution.


👤 Author

Developed by Francisco Jesús Montero Martínez
For suggestions, improvements, or collaboration, feel free to reach out.

About

Django API serving text classification models for content moderation.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages