Skip to content

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.

Notifications You must be signed in to change notification settings

LikoKiko/OpenCensor-Modal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

OpenCensor AI Service - My Final Year Project

This is my school project for final year in Software Engineering.

What is this?

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.

What it can do

  • 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.

How it works

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:

How to install

  1. Install Modal CLI: pip install modal
  2. Set up Modal account: modal setup

How to use the API

POST /predict

Check one text.

Ask:

{
  "text": "זה טקסט כלשהו :)",
  "threshold": 0.5,
  "max_length": 256
}

Answer:

{
  "prob": 0.05,
  "label": 0
}

POST /batch

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
  }
]

Project files

├── main.py           # Main code with FastAPI and model
├── README.md         # This file

What you need

  • Modal: For running on servers with GPUs.
  • FastAPI: For the web part.
  • PyTorch: For the AI work.
  • Transformers: From Hugging Face for models.

How to put it online

Works on Modal servers with:

  • Python 3 or more.
  • Pip for needed files.

Steps:

  1. Upload files to your work space.
  2. Set settings if needed (like model ID).
  3. Run modal deploy main.py.

Other related stuff

License

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:

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

About

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.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages