--- 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-detector` estimates 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 1. Create or activate a virtual environment that uses Python 3.9+. 2. Install dependencies: ```bash pip install -r requirements.txt ``` 3. Launch the interface: ```bash python app.py ``` 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. ## 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`, or `auto`). The default is `auto`, which prefers the bundled native implementation. - `TRUFOR_WEIGHTS`: absolute or relative path to `trufor.pth.tar` if you keep the file outside `weights/`. ## 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.