Processor

1. Create

Create a new example file:

facefusion/processors/modules/example.py

2. Implement

Define the inputs:

ExampleInputs = TypedDict('ExampleInputs',
{
	'reference_faces' : FaceSet,
	'source_face' : Face,
	'target_vision_frame' : VisionFrame
})

Implement the hooks of the processor:

from argparse import ArgumentParser
from typing import List

from facefusion.processors.typing import ExampleInputs

from facefusion.typing import ApplyStateItem, Args, Face, InferencePool, ProcessMode, UpdateProgress, VisionFrame


def get_inference_pool() -> InferencePool:
	pass


def clear_inference_pool() -> None:
	pass


def register_args(program : ArgumentParser) -> None:
	pass


def apply_args(args : Args, apply_state_item : ApplyStateItem) -> None:
	pass


def pre_check() -> bool:
	return True


def pre_process(mode : ProcessMode) -> bool:
	pass


def post_process() -> None:
	pass


def get_reference_frame(source_face : Face, target_face : Face, temp_vision_frame : VisionFrame) -> VisionFrame:
	pass


def process_frame(inputs : ExampleInputs) -> VisionFrame:
	pass


def process_frames(source_path : str, temp_frame_paths : List[str], update_progress : UpdateProgress) -> None:
	pass


def process_image(source_path : str, target_path : str, output_path : str) -> None:
	pass


def process_video(source_path : str, temp_frame_paths : List[str]) -> None:
	pass

3. Done

Finally, run the program:

python run.py --processors example