Spaces:
Running
FIX.md β How to Stop All Startup Errors
The logs show the OLD engine code is still running. The files from the previous session were not copied into the project. Do these steps in order.
Step 1 β Replace fingerprint engine
Copy fingerprint_engine.py (from outputs) to:
src/engines/fingerprint/engine.py
This removes all broken legacy models and fixes the trust_remote_code
duplicate kwarg bug.
Replaces with 3 working models:
Organika/sdxl-detectorhaywoodsloan/ai-image-detector-deploydima806/deepfake_vs_real_image_detection
Step 2 β Replace coherence engine
Copy coherence_engine.py (from outputs) to:
src/engines/coherence/engine.py
This removes the broken wav2vec-based audio model path with incompatible weights and random output behavior. Coherence now runs visual-only (FaceNet + MediaPipe).
Step 3 β Replace SSTGNN engine
Copy sstgnn_engine.py (from outputs) to:
src/engines/sstgnn/engine.py
Removes legacy ViT .pt checkpoint usage. Uses dima806 + prithivMLmods
only.
Step 4 β Fix the Dockerfile (libGLESv2 error)
Replace your Dockerfile with this exactly:
FROM python:3.11-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg \
libgl1 \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender1 \
libgles2 \
libegl1 \
libgbm1 \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
COPY . .
ENV MODEL_CACHE_DIR=/data/models
ENV TOKENIZERS_PARALLELISM=false
ENV MESA_GL_VERSION_OVERRIDE=3.3
ENV PYOPENGL_PLATFORM=egl
ENV PYTHONUNBUFFERED=1
EXPOSE 7860
CMD ["python", "spaces/app.py"]
The key additions are libgles2 libegl1 libgbm1 β MediaPipe requires OpenGL ES
even for CPU-only inference. Without these packages it always throws
libGLESv2.so.2: cannot open shared object file.
Step 5 β Fix requirements.txt (torch CVE block)
Replace the torch lines in requirements.txt:
torch>=2.6.0
torchvision>=0.21.0
torchaudio>=2.6.0
Torch < 2.6 blocks loading .pt files due to CVE-2025-32434. Since legacy
.pt checkpoints are removed, this is still a safety measure for other
dependencies that may call torch.load.
Step 6 β Rebuild and redeploy
# If running locally / Docker:
docker build --no-cache -t genai-deepdetect .
docker run -p 7860:7860 genai-deepdetect
# If on HuggingFace Spaces:
git add src/engines/fingerprint/engine.py
git add src/engines/coherence/engine.py
git add src/engines/sstgnn/engine.py
git add Dockerfile
git add requirements.txt
git commit -m "fix: remove broken models, add libgles2 for mediapipe"
git push
HF Spaces will rebuild the Docker image automatically on push. Watch the build logs β the apt-get install should now include libgles2.
What the fixed startup should look like
Fingerprint engine: loading models...
β detector: Organika/sdxl-detector
β detector: haywoodsloan/ai-image-detector-deploy
β detector: dima806/deepfake_vs_real_image_detection
β CLIP ViT-L/14 loaded for generator attribution
Fingerprint engine ready: 3 detectors, CLIP=ok
Coherence engine: loading models...
β FaceNet MTCNN + InceptionResnetV1 (VGGFace2) loaded
β MediaPipe FaceMesh loaded β only works after Dockerfile fix
Coherence engine ready: facenet=ok, mediapipe=ok
SSTGNN engine: loading models...
β SSTGNN detector: dima806/deepfake_vs_real_image_detection
β SSTGNN detector: prithivMLmods/Deep-Fake-Detector-Model
β MediaPipe FaceMesh loaded for SSTGNN graph
SSTGNN engine ready: 2 detectors, mediapipe=ok
Summary
| Error | Cause | Fix |
|---|---|---|
| Legacy GenD warnings | custom architecture | removed from engine |
| Legacy ViT torch CVE error | .pt file + torch < 2.6 |
removed from engine |
trust_remote_code TypeError |
duplicate kwarg in _build_image_classifier | removed from all pipeline() calls |
wav2vec MISSING/UNEXPECTED keys |
custom m_ssl.* namespace, incompatible | removed from engine |
libGLESv2.so.2 not found |
missing apt packages in Docker | add libgles2 libegl1 libgbm1 |