This is my school project for final year in Software Engineering.
OpenCensor AI Service is a fast AI service to find bad words in Hebrew text. It uses Modal, FastAPI, and Hugging Face tools. It acts as the backend AI that checks text for the OpenCensorAPI. This service runs on Modal servers with fast computer help and gives answers in real time.
- Runs on GPUs for quick checks.
- Grows or shrinks as needed, no wait to start.
- Checks many texts at the same time.
- You can change the sure level and max text length.
- Made just for Hebrew text.
This AI service (backend):
- Python code with FastAPI that handles requests.
- Runs on Modal servers with GPU help.
- Uses OpenCensor-Hebrew model from Hugging Face.
- Based on AlephBERT for Hebrew.
- 95% right, trained on over 3,000 Hebrew texts.
- Gives score from 0 (good) to 1 (bad).
Front-end API:
- See repo: https://github.com/LikoKiko/OpenCensor-API
- PHP middle layer for easy use.
- Install Modal CLI:
pip install modal - Set up Modal account:
modal setup
Check one text.
Ask:
{
"text": "זה טקסט כלשהו :)",
"threshold": 0.5,
"max_length": 256
}Answer:
{
"prob": 0.05,
"label": 0
}Check many texts (max 256).
Ask:
{
"texts": ["זה טקסט כלשהו 1", "זה טקסט כלשהו 2"],
"threshold": 0.5,
"max_length": 256
}Answer:
[
{
"prob": 0.05,
"label": 0
},
{
"prob": 0.85,
"label": 1
}
]├── main.py # Main code with FastAPI and model
├── README.md # This file
- Modal: For running on servers with GPUs.
- FastAPI: For the web part.
- PyTorch: For the AI work.
- Transformers: From Hugging Face for models.
Works on Modal servers with:
- Python 3 or more.
- Pip for needed files.
Steps:
- Upload files to your work space.
- Set settings if needed (like model ID).
- Run
modal deploy main.py.
- Frontend API: https://github.com/LikoKiko/OpenCensor-API
- Model: https://huggingface.co/LikoKIko/OpenCensor-Hebrew
- Demo: https://huggingface.co/spaces/LikoKIko/OpenCensor
This is a school project for final year in Software Engineering.
Give Credit: If you use this project or part of it in public, business, or school work, you must give credit to the maker. Include:
- Author: LikoKiko
- Project: OpenCensor AI Service - Hebrew Bad Words Checker
- Repository: https://github.com/LikoKIko/OpenCensor-Modal
How to Use:
- Free for school and research.
- Free to change and share if you give credit.
- Okay for business if you give credit.
- No promise it works, no blame if problems.
Example Credit:
Based on OpenCensor AI Service by LikoKiko
Original repository: https://github.com/LikoKIko/OpenCensor-Modal