image-verification / README.md
MaximusCorp's picture
Upload 9 files
5dd645e verified
|
Raw
History Blame Contribute Delete
2.47 kB
---
title: Axium Image Moderation Lab
colorFrom: blue
colorTo: gray
sdk: docker
app_port: 7860
pinned: false
license: apache-2.0
---
# Axium Image Moderation Lab
Small test application for sequential image moderation. An upload is checked in
this order and processing stops as soon as one test rejects it:
1. adult/NSFW content;
2. violence;
3. hateful-symbol visual heuristic;
4. offensive text detected after OCR.
An unavailable model never approves an image: the result is `error` and must be
reviewed manually.
## Create the free Hugging Face Space
1. Create an account at <https://huggingface.co/join>.
2. Open <https://huggingface.co/new-space>.
3. Choose a name such as `axium-image-moderation`.
4. Select **Docker** as the SDK and **CPU Basic - Free** as hardware.
5. Public visibility is sufficient for this test. Do not upload secrets into a
public file.
6. Create the Space, then open **Files -> Add file -> Upload files**.
7. Upload every file from this folder while keeping the `static` directory.
8. Wait for the status to become **Running**, then open the Space.
The first analysis can be slow because the four model files must be downloaded.
Free Spaces may sleep and need another cold start later.
## Optional configuration
In **Settings -> Variables and secrets -> Variables**, thresholds can be
adjusted without editing code:
```text
NSFW_THRESHOLD=0.82
VIOLENCE_THRESHOLD=0.80
HATE_SYMBOL_THRESHOLD=0.76
TOXIC_TEXT_THRESHOLD=0.78
MAX_UPLOAD_MB=8
```
Lower thresholds reject more images. Start conservatively and test them against
a representative, legally obtained image set before using the service in
production.
## Models
- `Falconsai/nsfw_image_detection` - Apache-2.0 model card.
- `jaranohaal/vit-base-violence-detection` - Apache-2.0 model card.
- `openai/clip-vit-base-patch32` - zero-shot heuristic for hateful symbols.
- `unitary/toxic-bert` - Apache-2.0 model card, applied to OCR text.
CLIP is only a heuristic here. It is not a reliable substitute for a curated
hateful-symbol dataset or human moderation. Review each model card, dataset,
limitations and license before commercial deployment.
## Production integration
Do not publish an image while its state is `pending`, `error`, or `review`.
Production integration should add signed server-to-server requests, persistent
rate limiting, a queue, audit logs and an admin review screen. The public test
page intentionally does not contain an Axium server secret.