Spaces:
Running
Running
victorisgeek
commited on
Commit
β’
2064afe
1
Parent(s):
08ce2b7
Update app.py
Browse files
app.py
CHANGED
@@ -69,7 +69,6 @@ FACE_SWAPPER = None
|
|
69 |
FACE_ANALYSER = None
|
70 |
FACE_ENHANCER = None
|
71 |
FACE_PARSER = None
|
72 |
-
NSFW_DETECTOR = None
|
73 |
FACE_ENHANCER_LIST = ["NONE"]
|
74 |
FACE_ENHANCER_LIST.extend(get_available_enhancer_names())
|
75 |
FACE_ENHANCER_LIST.extend(cv2_interpolations)
|
@@ -117,11 +116,6 @@ def load_face_parser_model(path="./assets/pretrained_models/79999_iter.pth"):
|
|
117 |
if FACE_PARSER is None:
|
118 |
FACE_PARSER = init_parsing_model(path, device=device)
|
119 |
|
120 |
-
def load_nsfw_detector_model(path="./assets/pretrained_models/open-nsfw.onnx"):
|
121 |
-
global NSFW_DETECTOR
|
122 |
-
if NSFW_DETECTOR is None:
|
123 |
-
NSFW_DETECTOR = NSFWChecker(model_path=path, providers=PROVIDER)
|
124 |
-
|
125 |
|
126 |
load_face_analyser_model()
|
127 |
load_face_swapper_model()
|
@@ -226,17 +220,7 @@ def process(
|
|
226 |
def swap_process(image_sequence):
|
227 |
## ------------------------------ CONTENT CHECK ------------------------------
|
228 |
|
229 |
-
|
230 |
-
nsfw = NSFW_DETECTOR.is_nsfw(image_sequence)
|
231 |
-
if nsfw:
|
232 |
-
message = "NSFW Content detected !!!"
|
233 |
-
yield f"### \n π {message}", *ui_before()
|
234 |
-
assert not nsfw, message
|
235 |
-
return True
|
236 |
-
EMPTY_CACHE()
|
237 |
-
|
238 |
-
## ------------------------------ ANALYSE FACE ------------------------------
|
239 |
-
|
240 |
yield "### \n β Analysing face data...", *ui_before()
|
241 |
if condition != "Specific Face":
|
242 |
source_data = source_path, age
|
|
|
69 |
FACE_ANALYSER = None
|
70 |
FACE_ENHANCER = None
|
71 |
FACE_PARSER = None
|
|
|
72 |
FACE_ENHANCER_LIST = ["NONE"]
|
73 |
FACE_ENHANCER_LIST.extend(get_available_enhancer_names())
|
74 |
FACE_ENHANCER_LIST.extend(cv2_interpolations)
|
|
|
116 |
if FACE_PARSER is None:
|
117 |
FACE_PARSER = init_parsing_model(path, device=device)
|
118 |
|
|
|
|
|
|
|
|
|
|
|
119 |
|
120 |
load_face_analyser_model()
|
121 |
load_face_swapper_model()
|
|
|
220 |
def swap_process(image_sequence):
|
221 |
## ------------------------------ CONTENT CHECK ------------------------------
|
222 |
|
223 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
yield "### \n β Analysing face data...", *ui_before()
|
225 |
if condition != "Specific Face":
|
226 |
source_data = source_path, age
|