|
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 {} |
|
|
|
|
|
def clear_inference_pool() -> None: |
|
pass |
|
|
|
|
|
def get_model_options() -> ModelOptions: |
|
return {} |
|
|
|
|
|
def pre_check() -> bool: |
|
return True |
|
|
|
|
|
def analyse_stream(vision_frame: VisionFrame, video_fps: Fps) -> bool: |
|
return False |
|
|
|
|
|
def analyse_frame(vision_frame: VisionFrame) -> bool: |
|
return False |
|
|
|
|
|
@lru_cache(maxsize=None) |
|
def analyse_image(image_path: str) -> bool: |
|
return False |
|
|
|
|
|
@lru_cache(maxsize=None) |
|
def analyse_video(video_path: str, trim_frame_start: int, trim_frame_end: int) -> bool: |
|
return False |
|
|
|
|
|
def detect_nsfw(vision_frame: VisionFrame) -> List[Score]: |
|
return [] |
|
|
|
|
|
def forward(vision_frame: VisionFrame) -> Detection: |
|
return [] |
|
|
|
|
|
def prepare_detect_frame(temp_vision_frame: VisionFrame) -> VisionFrame: |
|
return temp_vision_frame |
|
|