mirror of
https://github.com/facefusion/facefusion.git
synced 2026-04-28 20:46:26 +02:00
workflows rename
This commit is contained in:
@@ -45,7 +45,7 @@ face_mask_regions : List[FaceMaskRegion] = list(face_mask_region_set.keys())
|
||||
|
||||
voice_extractor_models : List[VoiceExtractorModel] = [ 'kim_vocal_1', 'kim_vocal_2', 'uvr_mdxnet' ]
|
||||
|
||||
workflows : List[WorkFlow] = [ 'auto', 'audio-to-image:video', 'image-to-image', 'image-to-video', 'image-to-video:frame' ]
|
||||
workflows : List[WorkFlow] = [ 'auto', 'audio-to-image:video', 'image-to-image', 'image-to-video', 'image-to-video:frames' ]
|
||||
|
||||
audio_type_set : AudioTypeSet =\
|
||||
{
|
||||
|
||||
+4
-4
@@ -20,7 +20,7 @@ from facefusion.processors.core import get_processors_modules
|
||||
from facefusion.program import create_program
|
||||
from facefusion.program_helper import validate_args
|
||||
from facefusion.types import Args, ErrorCode, WorkFlow
|
||||
from facefusion.workflows import audio_to_image, image_to_image, image_to_video, image_to_video_as_sequence
|
||||
from facefusion.workflows import audio_to_image, image_to_image, image_to_video, image_to_video_as_frames
|
||||
|
||||
|
||||
def cli() -> None:
|
||||
@@ -342,8 +342,8 @@ def conditional_process() -> ErrorCode:
|
||||
return image_to_image.process(start_time)
|
||||
if state_manager.get_item('workflow') == 'image-to-video':
|
||||
return image_to_video.process(start_time)
|
||||
if state_manager.get_item('workflow') == 'image-to-video:frame':
|
||||
return image_to_video_as_sequence.process(start_time)
|
||||
if state_manager.get_item('workflow') == 'image-to-video:frames':
|
||||
return image_to_video_as_frames.process(start_time)
|
||||
|
||||
return 0
|
||||
|
||||
@@ -352,7 +352,7 @@ def detect_workflow() -> WorkFlow:
|
||||
if has_video([ state_manager.get_item('target_path') ]):
|
||||
if get_file_extension(state_manager.get_item('output_path')):
|
||||
return 'image-to-video'
|
||||
return 'image-to-video:frame'
|
||||
return 'image-to-video:frames'
|
||||
|
||||
if has_audio(state_manager.get_item('source_paths')) and has_image([ state_manager.get_item('target_path') ]):
|
||||
return 'audio-to-image:video'
|
||||
|
||||
@@ -40,8 +40,8 @@ LOCALES : Locales =\
|
||||
'processing_stopped': 'processing stopped',
|
||||
'processing_image_succeeded': 'processing to image succeeded in {seconds} seconds',
|
||||
'processing_image_failed': 'processing to image failed',
|
||||
'processing_sequence_succeeded': 'processing to sequence succeeded in {seconds} seconds',
|
||||
'processing_sequence_failed': 'processing to sequence failed',
|
||||
'processing_frames_succeeded': 'processing to frames succeeded in {seconds} seconds',
|
||||
'processing_frames_failed': 'processing to frames failed',
|
||||
'processing_video_succeeded': 'processing to video succeeded in {seconds} seconds',
|
||||
'processing_video_failed': 'processing to video failed',
|
||||
'choose_image_source': 'choose an image for the source',
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ Language = Literal['en']
|
||||
Locales : TypeAlias = Dict[Language, Dict[str, Any]]
|
||||
LocalePoolSet : TypeAlias = Dict[str, Locales]
|
||||
|
||||
WorkFlow = Literal['auto', 'audio-to-image:video', 'image-to-image', 'image-to-video', 'image-to-video:frame']
|
||||
WorkFlow = Literal['auto', 'audio-to-image:video', 'image-to-image', 'image-to-video', 'image-to-video:frames']
|
||||
|
||||
VideoCaptureSet : TypeAlias = Dict[str, cv2.VideoCapture]
|
||||
VideoWriterSet : TypeAlias = Dict[str, cv2.VideoWriter]
|
||||
|
||||
@@ -69,7 +69,7 @@ def conditional_get_source_voice_frame(frame_number: int) -> AudioFrame:
|
||||
|
||||
|
||||
def conditional_get_reference_vision_frame() -> VisionFrame:
|
||||
if state_manager.get_item('workflow') in [ 'image-to-video', 'image-to-video:frame' ]:
|
||||
if state_manager.get_item('workflow') in [ 'image-to-video', 'image-to-video:frames' ]:
|
||||
return read_static_video_frame(state_manager.get_item('target_path'), state_manager.get_item('reference_frame_number'))
|
||||
return read_static_image(state_manager.get_item('target_path'))
|
||||
|
||||
|
||||
+4
-4
@@ -19,7 +19,7 @@ def process(start_time : float) -> ErrorCode:
|
||||
create_temp_frames,
|
||||
process_frames,
|
||||
copy_temp_frames,
|
||||
partial(finalize_sequence, start_time),
|
||||
partial(finalize_frames, start_time),
|
||||
clear
|
||||
]
|
||||
|
||||
@@ -45,10 +45,10 @@ def copy_temp_frames() -> ErrorCode:
|
||||
return 0
|
||||
|
||||
|
||||
def finalize_sequence(start_time : float) -> ErrorCode:
|
||||
def finalize_frames(start_time : float) -> ErrorCode:
|
||||
if are_images(resolve_file_paths(state_manager.get_item('output_path'))):
|
||||
logger.info(translator.get('processing_sequence_succeeded').format(seconds = calculate_end_time(start_time)), __name__)
|
||||
logger.info(translator.get('processing_frames_succeeded').format(seconds = calculate_end_time(start_time)), __name__)
|
||||
else:
|
||||
logger.error(translator.get('processing_sequence_failed'), __name__)
|
||||
logger.error(translator.get('processing_frames_failed'), __name__)
|
||||
return 1
|
||||
return 0
|
||||
@@ -38,8 +38,8 @@ def test_modify_age_to_video() -> None:
|
||||
assert is_test_output_file('test-age-face-to-video.mp4') is True
|
||||
|
||||
|
||||
def test_modify_age_to_video_as_sequence() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video:frame', '--jobs-path', get_test_jobs_directory(), '--processors', 'age_modifier', '--age-modifier-direction', '100', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-age-face-to-video-as-sequence'), '--trim-frame-end', '1' ]
|
||||
def test_modify_age_to_video_as_frames() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video:frames', '--jobs-path', get_test_jobs_directory(), '--processors', 'age_modifier', '--age-modifier-direction', '100', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-age-face-to-video-as-frames'), '--trim-frame-end', '1' ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_sequence(get_test_output_path('test-age-face-to-video-as-sequence')) is True
|
||||
assert is_test_output_sequence(get_test_output_path('test-age-face-to-video-as-frames')) is True
|
||||
|
||||
@@ -39,8 +39,8 @@ def test_remove_background_to_video() -> None:
|
||||
assert is_test_output_file('test-remove-background-to-video.mp4') is True
|
||||
|
||||
|
||||
def test_remove_background_to_video_as_sequence() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video:frame', '--jobs-path', get_test_jobs_directory(), '--processors', 'background_remover', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-remove-background-to-video-as-sequence'), '--trim-frame-end', '1' ]
|
||||
def test_remove_background_to_video_as_frames() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video:frames', '--jobs-path', get_test_jobs_directory(), '--processors', 'background_remover', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-remove-background-to-video-as-frames'), '--trim-frame-end', '1' ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_sequence(get_test_output_path('test-remove-background-to-video-as-sequence')) is True
|
||||
assert is_test_output_sequence(get_test_output_path('test-remove-background-to-video-as-frames')) is True
|
||||
|
||||
@@ -38,8 +38,8 @@ def test_restore_expression_to_video() -> None:
|
||||
assert is_test_output_file('test-restore-expression-to-video.mp4') is True
|
||||
|
||||
|
||||
def test_restore_expression_to_video_as_sequence() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video:frame', '--jobs-path', get_test_jobs_directory(), '--processors', 'expression_restorer', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-restore-expression-to-video-as-sequence'), '--trim-frame-end', '1' ]
|
||||
def test_restore_expression_to_video_as_frames() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video:frames', '--jobs-path', get_test_jobs_directory(), '--processors', 'expression_restorer', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-restore-expression-to-video-as-frames'), '--trim-frame-end', '1' ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_sequence(get_test_output_path('test-restore-expression-to-video-as-sequence')) is True
|
||||
assert is_test_output_sequence(get_test_output_path('test-restore-expression-to-video-as-frames')) is True
|
||||
|
||||
@@ -39,8 +39,8 @@ def test_debug_face_to_video() -> None:
|
||||
assert is_test_output_file('test-debug-face-to-video.mp4') is True
|
||||
|
||||
|
||||
def test_debug_face_to_video_as_sequence() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video:frame', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_debugger', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-debug-face-to-video-as-sequence'), '--trim-frame-end', '1' ]
|
||||
def test_debug_face_to_video_as_frames() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video:frames', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_debugger', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-debug-face-to-video-as-frames'), '--trim-frame-end', '1' ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_sequence(get_test_output_path('test-debug-face-to-video-as-sequence')) is True
|
||||
assert is_test_output_sequence(get_test_output_path('test-debug-face-to-video-as-frames')) is True
|
||||
|
||||
@@ -39,8 +39,8 @@ def test_edit_face_to_video() -> None:
|
||||
assert is_test_output_file('test-edit-face-to-video.mp4') is True
|
||||
|
||||
|
||||
def test_edit_face_to_video_as_sequence() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video:frame', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_editor', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-edit-face-to-video-as-sequence'), '--trim-frame-end', '1' ]
|
||||
def test_edit_face_to_video_as_frames() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video:frames', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_editor', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-edit-face-to-video-as-frames'), '--trim-frame-end', '1' ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_sequence(get_test_output_path('test-edit-face-to-video-as-sequence')) is True
|
||||
assert is_test_output_sequence(get_test_output_path('test-edit-face-to-video-as-frames')) is True
|
||||
|
||||
@@ -39,8 +39,8 @@ def test_enhance_face_to_video() -> None:
|
||||
assert is_test_output_file('test-enhance-face-to-video.mp4') is True
|
||||
|
||||
|
||||
def test_enhance_face_to_video_as_sequence() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video:frame', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_enhancer', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-enhance-face-to-video-as-sequence'), '--trim-frame-end', '1' ]
|
||||
def test_enhance_face_to_video_as_frames() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video:frames', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_enhancer', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-enhance-face-to-video-as-frames'), '--trim-frame-end', '1' ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_sequence(get_test_output_path('test-enhance-face-to-video-as-sequence')) is True
|
||||
assert is_test_output_sequence(get_test_output_path('test-enhance-face-to-video-as-frames')) is True
|
||||
|
||||
@@ -39,8 +39,8 @@ def test_swap_face_to_video() -> None:
|
||||
assert is_test_output_file('test-swap-face-to-video.mp4') is True
|
||||
|
||||
|
||||
def test_swap_face_to_video_as_sequence() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video:frame', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_swapper', '-s', get_test_example_file('source.jpg'), '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-swap-face-to-video-as-sequence'), '--trim-frame-end', '1' ]
|
||||
def test_swap_face_to_video_as_frames() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video:frames', '--jobs-path', get_test_jobs_directory(), '--processors', 'face_swapper', '-s', get_test_example_file('source.jpg'), '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-swap-face-to-video-as-frames'), '--trim-frame-end', '1' ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_sequence(get_test_output_path('test-swap-face-to-video-as-sequence')) is True
|
||||
assert is_test_output_sequence(get_test_output_path('test-swap-face-to-video-as-frames')) is True
|
||||
|
||||
@@ -40,8 +40,8 @@ def test_colorize_frame_to_video() -> None:
|
||||
assert is_test_output_file('test-colorize-frame-to-video.mp4') is True
|
||||
|
||||
|
||||
def test_colorize_frame_to_video_as_sequence() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video:frame', '--jobs-path', get_test_jobs_directory(), '--processors', 'frame_colorizer', '-t', get_test_example_file('target-240p-0sat.mp4'), '-o', get_test_output_path('test-colorize-frame-to-video-as-sequence'), '--trim-frame-end', '1' ]
|
||||
def test_colorize_frame_to_video_as_frames() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video:frames', '--jobs-path', get_test_jobs_directory(), '--processors', 'frame_colorizer', '-t', get_test_example_file('target-240p-0sat.mp4'), '-o', get_test_output_path('test-colorize-frame-to-video-as-frames'), '--trim-frame-end', '1' ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_sequence(get_test_output_path('test-colorize-frame-to-video-as-sequence')) is True
|
||||
assert is_test_output_sequence(get_test_output_path('test-colorize-frame-to-video-as-frames')) is True
|
||||
|
||||
@@ -39,8 +39,8 @@ def test_enhance_frame_to_video() -> None:
|
||||
assert is_test_output_file('test-enhance-frame-to-video.mp4') is True
|
||||
|
||||
|
||||
def test_enhance_frame_to_video_as_sequence() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video:frame', '--jobs-path', get_test_jobs_directory(), '--processors', 'frame_enhancer', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-enhance-frame-to-video-as-sequence'), '--trim-frame-end', '1' ]
|
||||
def test_enhance_frame_to_video_as_frames() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video:frames', '--jobs-path', get_test_jobs_directory(), '--processors', 'frame_enhancer', '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test-enhance-frame-to-video-as-frames'), '--trim-frame-end', '1' ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_sequence(get_test_output_path('test-enhance-frame-to-video-as-sequence')) is True
|
||||
assert is_test_output_sequence(get_test_output_path('test-enhance-frame-to-video-as-frames')) is True
|
||||
|
||||
@@ -40,8 +40,8 @@ def test_sync_lip_to_video() -> None:
|
||||
assert is_test_output_file('test_sync_lip_to_video.mp4') is True
|
||||
|
||||
|
||||
def test_sync_lip_to_video_as_sequence() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video:frame', '--jobs-path', get_test_jobs_directory(), '--processors', 'lip_syncer', '-s', get_test_example_file('source.mp3'), '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test_sync_lip_to_video_as_sequence'), '--trim-frame-end', '1' ]
|
||||
def test_sync_lip_to_video_as_frames() -> None:
|
||||
commands = [ sys.executable, 'facefusion.py', 'run', '--workflow', 'image-to-video:frames', '--jobs-path', get_test_jobs_directory(), '--processors', 'lip_syncer', '-s', get_test_example_file('source.mp3'), '-t', get_test_example_file('target-240p.mp4'), '-o', get_test_output_path('test_sync_lip_to_video_as_frames'), '--trim-frame-end', '1' ]
|
||||
|
||||
assert subprocess.run(commands).returncode == 0
|
||||
assert is_test_output_sequence(get_test_output_path('test_sync_lip_to_video_as_sequence')) is True
|
||||
assert is_test_output_sequence(get_test_output_path('test_sync_lip_to_video_as_frames')) is True
|
||||
|
||||
Reference in New Issue
Block a user