onyeonwoo/Anti_AI_Filter
0
Anti AI Filter
FastAPI 기반 이미지 보호 API입니다. 업로드된 이미지를 JND-EoT 필터로 변환하고, 원본/보호본에 대한 AI 분석 결과와 attention heatmap을 반환합니다.
Local Backend
cd anti-ai-filter
pip install -r requirements.txt
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
uvicorn main:app --host 0.0.0.0 --port 7860API 확인:
curl http://localhost:7860/Protection Flow
- The browser uploads an image and an intensity value to
POST /protect. main.pycallsapply_protection_filterand returns the protected PNG as a data URL.filter.pyoptimizes a small perturbation in RGB pixel space.- The perturbation is clipped by a JND mask so it stays visually subtle.
- The surrogate ResNet input is normalized only at model-evaluation time, not while applying the final pixel noise.
- The API also returns original/protected model labels and Grad-CAM style heatmaps for comparison.
This is a defensive protection layer for user-owned images. It can reduce model confidence for the surrogate model, but it should not be treated as a universal guarantee against every training or classification pipeline.
Docker
docker build -t anti-ai-filter .
docker run --rm -p 7860:7860 anti-ai-filterThe Docker build uses .dockerignore to exclude local caches, frontend build output, sample images, and helper tools from the runtime image.
Frontend
cd anti-ai-filter/frontend
npm install
npm run build프론트엔드는 REACT_APP_API_URL 환경변수로 백엔드 URL을 받습니다.
Deployment
GitHub Actions는 anti-ai-filter/ 폴더만 Hugging Face Space 루트로 복사해서 Docker Space에 강제 푸시합니다. 따라서 Hugging Face는 이 폴더의 Dockerfile과 README front matter를 기준으로 빌드합니다.
