refactor: use source code patch instead of deleting NSFW models
Cleaner solution based on Reddit community feedback: - Patch content_analyser.py to return False (always safe) - Remove unused config file - Remove config volume mount from compose - Much simpler and more reliable than file deletion approach Credit: https://www.reddit.com/r/StableDiffusion/comments/1m2w5af/ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -167,7 +167,6 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ai_facefusion_data:/workspace
|
- ai_facefusion_data:/workspace
|
||||||
- ./entrypoint.sh:/entrypoint.sh:ro
|
- ./entrypoint.sh:/entrypoint.sh:ro
|
||||||
- ./facefusion-config.ini:/config/facefusion-config.ini:ro
|
|
||||||
networks:
|
networks:
|
||||||
- compose_network
|
- compose_network
|
||||||
labels:
|
labels:
|
||||||
|
|||||||
@@ -1,15 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
echo "Starting Facefusion..."
|
echo "Patching Facefusion to disable NSFW filter..."
|
||||||
# Start Facefusion in the background
|
|
||||||
python -u facefusion.py run --config-path /config/facefusion-config.ini &
|
|
||||||
FACEFUSION_PID=$!
|
|
||||||
|
|
||||||
echo "Waiting 90 seconds for model downloads..."
|
# Patch content_analyser.py to always return False (content is safe)
|
||||||
sleep 90
|
sed -i '197s/.*/\treturn False # Patched: NSFW filter disabled/' /facefusion/facefusion/content_analyser.py
|
||||||
|
|
||||||
echo "Deleting NSFW models..."
|
echo "NSFW filter disabled. Starting Facefusion..."
|
||||||
rm -vf /facefusion/.assets/models/nsfw_*.onnx /facefusion/.assets/models/nsfw_*.hash
|
exec python -u facefusion.py run
|
||||||
|
|
||||||
echo "NSFW models deleted. Facefusion is running."
|
|
||||||
# Wait for the main process
|
|
||||||
wait $FACEFUSION_PID
|
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
[content_analyser]
|
|
||||||
enabled = false
|
|
||||||
Reference in New Issue
Block a user