File size: 4,727 Bytes
db974fe
9c66281
 
 
 
 
 
 
 
3b90f7a
db974fe
 
b36b739
9c66281
b36b739
9c66281
db974fe
9c66281
db974fe
9c66281
db974fe
 
 
9c66281
a420353
 
db974fe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8974103
db974fe
 
 
 
 
9c66281
5e8be73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
db974fe
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
---
title: Deepfake Detection Bypass Utility
emoji: πŸ‘
colorFrom: red
colorTo: yellow
sdk: gradio
sdk_version: 5.35.0
app_file: app_gradio.py
pinned: true
short_description: DF detection circumvention utility refactored for HF Spaces.
---


# Image Detection Bypass Utility [Gradio Refactor]

Refactored Gradio app for HF Spaces of [Image Detection Bypass](https://github.com/PurinNyova/Image-Detection-Bypass-Utility), self-proclaimed app for the "Circumvention of AI Detection."

Strictly for research purposes -- please refer to the original repository for more in-depth documentation and up-to-date code. 

This refactored repository will not be maintained.

---

## Screenshot

![image/png](https://cdn-uploads.huggingface.co/production/uploads/639daf827270667011153fbc/zMAmg93CH66zgMkgxAsez.png)

---

## Parameters / Controls β†’ `args` mapping

When you click **Run**, the GUI builds a lightweight argument namespace (similar to a `SimpleNamespace`) and passes it to the worker. Below are the important mappings used by the GUI (so you know what your `process_image` should expect):

- `args.noise_std` β€” Gaussian noise STD (fraction of 255)  
- `args.clahe_clip` β€” CLAHE clip limit  
- `args.tile` β€” CLAHE tile size  
- `args.cutoff` β€” Fourier cutoff (0.01–1.0)  
- `args.fstrength` β€” Fourier strength (0–1)  
- `args.phase_perturb` β€” phase perturbation STD (radians)  
- `args.randomness` β€” Fourier randomness factor  
- `args.perturb` β€” small pixel perturbations  
- `args.fft_mode` β€” one of `auto`, `ref`, `model`  
- `args.fft_alpha` β€” alpha exponent for 1/f model (used when `fft_mode=='model'`)  
- `args.radial_smooth` β€” radial smoothing bins for spectrum matching  
- `args.jpeg_cycles` β€” number of lossy JPEG encode/decode cycles (camera sim)  
- `args.jpeg_qmin`, `args.jpeg_qmax` β€” JPEG quality range used by camera sim  
- `args.vignette_strength` β€” vignette intensity (0–1)  
- `args.chroma_strength` β€” chromatic aberration strength (pixels)  
- `args.iso_scale` β€” exposure multiplier (camera sim)  
- `args.read_noise` β€” read noise in DN (camera sim)  
- `args.hot_pixel_prob` β€” probability of hot pixels (camera sim)  
- `args.banding_strength` β€” banding strength  
- `args.motion_blur_kernel` β€” motion blur kernel size  
- `args.seed` β€” integer seed or `None` when seed==0 in UI  
- `args.sim_camera` β€” bool: run camera simulation path  
- `args.no_no_bayer` β€” toggles Bayer/demosaic (True = enable RGGB demosaic)  
- `args.fft_ref` β€” path to reference image (string) or `None`
- `args.ref`β€” path to auto white-balance reference image (string) or `None`

> **Tip:** Your `process_image(inpath, outpath, args)` should be tolerant of missing keys (use `getattr(args, 'name', default)`), or accept the same `SimpleNamespace` object the GUI builds.

---

## Gradio / Hugging Face Spaces

This repository includes a lightweight Gradio front-end (`app_gradio.py`) that wraps the existing
`process_image(inpath, outpath, args)` pipeline. The Gradio app is suitable for local testing and
for deployment to Hugging Face Spaces (Gradio-backed web apps).

### Quick local run

1. Install dependencies:

```bash
pip install -r requirements.txt
```

2. Launch the Gradio app:

```bash
python3 app_gradio.py
```

Open http://localhost:7860 in your browser. The UI saves the uploaded image to a temporary file,
calls the existing `process_image` pipeline, and returns the processed image.

### Deploying to Hugging Face Spaces

1. Ensure the following are present at the repository root:
     - `app_gradio.py` (the Gradio entrypoint)
     - `requirements.txt` (must include `gradio` and any other runtime deps)

2. Push the repository to a new Space on Hugging Face (create a new Space and connect this repo or
     push to the Space's Git remote). Spaces will automatically run the Gradio app.

Notes & tips for Spaces:
- Keep default upload/processing sizes modest to avoid long CPU usage in the free tier.
- If your pipeline uses optional packages (OpenCV, piexif, etc.), make sure they are listed in
    `requirements.txt` so Spaces installs them.
- If processing is slow, consider reducing default image size or exposing fewer parameters to the
    main UI and keeping advanced controls hidden in an "Advanced" section.

### Troubleshooting
- If Gradio is not installed, `app_gradio.py` will raise an error; add `gradio` to `requirements.txt`.
- Any import errors from `image_postprocess` will surface when calling the app; run the smoke test
    (`python3 test_smoke_gradio.py`) locally to validate imports and pipeline execution before pushing.

---

## License
MIT β€” free to use and adapt. Please include attribution if you fork or republish.

---