Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
·
eec2b47
1
Parent(s):
83c337a
init
Browse files- __lib__/app.pyc +1 -1
- __lib__/i18n/en.pyc +1 -1
- __lib__/util.pyc +2 -2
- nfsw_filter.py +10 -0
__lib__/app.pyc
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 116861
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:492f08b6358ca855bfccfbec5c974b6867ce6647fbd2186acb15520a017174f5
|
| 3 |
size 116861
|
__lib__/i18n/en.pyc
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 10609
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:869196ee815722c15de51f9a86ad3e20a92ff3f8cb02bceb7d9851186684bd3f
|
| 3 |
size 10609
|
__lib__/util.pyc
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5434fd34ed8bc4cd11199780193735ee6c89a4da64a61e6157984a56fa95341e
|
| 3 |
+
size 40121
|
nfsw_filter.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
from PIL import Image
|
| 3 |
import numpy as np
|
|
@@ -255,6 +257,14 @@ if __name__ == "__main__":
|
|
| 255 |
predicted_label = detector.predict_label_only(single_image_path)
|
| 256 |
print(f"Image file: {single_image_path}")
|
| 257 |
print(f"Prediction: {predicted_label}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 258 |
else:
|
| 259 |
print(f"Error: Image file does not exist: {single_image_path}")
|
| 260 |
|
|
|
|
| 1 |
+
# Strict mode: When predicted as NSFW, apply image blurring.
|
| 2 |
+
|
| 3 |
import os
|
| 4 |
from PIL import Image
|
| 5 |
import numpy as np
|
|
|
|
| 257 |
predicted_label = detector.predict_label_only(single_image_path)
|
| 258 |
print(f"Image file: {single_image_path}")
|
| 259 |
print(f"Prediction: {predicted_label}")
|
| 260 |
+
|
| 261 |
+
# Strict NSFW check
|
| 262 |
+
if predicted_label.lower() == "nsfw":
|
| 263 |
+
print("❌ NSFW content detected, image will be blurred!")
|
| 264 |
+
# TODO: Add image blur logic here
|
| 265 |
+
else:
|
| 266 |
+
print("✅ Image content is normal, allowed to use")
|
| 267 |
+
|
| 268 |
else:
|
| 269 |
print(f"Error: Image file does not exist: {single_image_path}")
|
| 270 |
|