from functools import lru_cache from typing import List import numpy from tqdm import tqdm from facefusion import inference_manager, state_manager, wording from facefusion.download import conditional_download_hashes, conditional_download_sources, resolve_download_url from facefusion.filesystem import resolve_relative_path from facefusion.thread_helper import conditional_thread_semaphore from facefusion.types import Detection, DownloadScope, Fps, InferencePool, ModelOptions, ModelSet, Score, VisionFrame from facefusion.vision import detect_video_fps, fit_frame, read_image, read_video_frame STREAM_COUNTER = 0 @lru_cache(maxsize=None) def create_static_model_set(download_scope: DownloadScope) -> ModelSet: return { 'yolo_nsfw': { 'hashes': {}, 'sources': {}, 'size': (640, 640) } } def get_inference_pool() -> InferencePool: return {} # ✅ NSFW model pool disabled def clear_inference_pool() -> None: pass # ✅ No NSFW inference clearing needed def get_model_options() -> ModelOptions: return {} # ✅ No NSFW model options def pre_check() -> bool: return True # ✅ Always return True (Skip NSFW model check) def analyse_stream(vision_frame: VisionFrame, video_fps: Fps) -> bool: return False # ✅ No NSFW analysis def analyse_frame(vision_frame: VisionFrame) -> bool: return False # ✅ No NSFW detection @lru_cache(maxsize=None) def analyse_image(image_path: str) -> bool: return False # ✅ No NSFW check for images @lru_cache(maxsize=None) def analyse_video(video_path: str, trim_frame_start: int, trim_frame_end: int) -> bool: return False # ✅ No NSFW check for videos def detect_nsfw(vision_frame: VisionFrame) -> List[Score]: return [] # ✅ Always return empty NSFW scores (No detection) def forward(vision_frame: VisionFrame) -> Detection: return [] # ✅ No detection happening def prepare_detect_frame(temp_vision_frame: VisionFrame) -> VisionFrame: return temp_vision_frame # ✅ No modifications needed