Spaces:
Sleeping
Sleeping
| 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 | |
| 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 | |
| def analyse_image(image_path: str) -> bool: | |
| return False # β No NSFW check for images | |
| 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 | |