Processor

1. Create

Create a new example file:

facefusion/processors/modules/example.py

2. Implement

Define the inputs:

ExampleInputs = TypedDict('ExampleInputs',
{
	'reference_vision_frame' : VisionFrame,
	'source_faces' : List[Face],
	'target_vision_frame' : VisionFrame
})

Implement the hooks of the processor:

from argparse import ArgumentParser

from facefusion.processors.typing import ExampleInputs

from facefusion.typing import ApplyStateItem, Args, Face, InferencePool, ProcessMode, 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 process_frame(inputs : ExampleInputs) -> VisionFrame:
	pass

3. Done

Finally, run the program:

python run.py --processors example

Last updated