Spaces:
Running
Running
metadata
title: Tru Image Classifier
emoji: π
colorFrom: purple
colorTo: gray
sdk: gradio
sdk_version: 5.49.1
app_file: app.py
pinned: false
license: mit
Hugging Face Interface Demo
This Gradio app compares two detectors for image provenance:
- Hugging Face
Ateeqq/ai-vs-human-image-detectorestimates whether an image is AI-generated or human-made. - A bundled TruFor backend estimates tampering and renders heatmaps when the required weights are present.
Requirements
- Python 3.9 or newer
pip install -r requirements.txt
Getting Started
- Create or activate a virtual environment that uses Python 3.9+.
- Install dependencies:
pip install -r requirements.txt - Launch the interface:
Gradio prints a local URL in the terminal; open it in a browser and upload an image to view the AI/Human probabilities alongside TruFor diagnostics.python app.py
TruFor Weights
TruFor is released for non-commercial research use. Obtain the official trufor.pth.tar weight file from the upstream project and place it at weights/trufor.pth.tar (or set the environment variable TRUFOR_WEIGHTS to point to the file). When the weights are available, the app switches to the native TruFor backend and overlays tamper and confidence heatmaps next to the classifier output.
Optional environment variables:
TRUFOR_BACKEND: force a backend (native,docker, orauto). The default isauto, which prefers the bundled native implementation.TRUFOR_WEIGHTS: absolute or relative path totrufor.pth.tarif you keep the file outsideweights/.
Notes
- The TruFor assets are redistributed here as Python modules for convenience, but you must still respect the upstream license for any research or redistribution.
- Docker support remains available for legacy setups, but no container build steps are required when using the bundled backend.