guard workflow (#1211)

This commit is contained in:
Harisreedhar
2026-07-29 17:44:01 +05:30
committed by GitHub
parent 2ca5fba316
commit 7b31f425ff
3 changed files with 12 additions and 22 deletions
+11 -8
View File
@@ -315,16 +315,19 @@ def conditional_process() -> ErrorCode:
if state_manager.get_item('workflow_mode') == 'auto':
state_manager.set_item('workflow_mode', detect_workflow_mode())
for processor_module in get_processors_modules(state_manager.get_item('processors')):
if not processor_module.pre_process('output'):
return 2
if state_manager.get_item('workflow_mode') == detect_workflow_mode():
for processor_module in get_processors_modules(state_manager.get_item('processors')):
if not processor_module.pre_process('output'):
return 2
if state_manager.get_item('workflow_mode') == 'image-to-image':
return image_to_image.process(start_time)
if state_manager.get_item('workflow_mode') == 'image-to-video':
return image_to_video.process(start_time)
if state_manager.get_item('workflow_mode') == 'image-to-image':
return image_to_image.process(start_time)
if state_manager.get_item('workflow_mode') == 'image-to-video':
return image_to_video.process(start_time)
return 0
return 0
return 2
def detect_workflow_mode() -> WorkflowMode:
-1
View File
@@ -204,7 +204,6 @@ LOCALES : Locales =\
'clear_button': 'CLEAR',
'download_providers_checkbox_group': 'DOWNLOAD PROVIDERS',
'execution_providers_checkbox_group': 'EXECUTION PROVIDERS',
'workflow_mode_dropdown': 'WORKFLOW MODE',
'workflow_strategy_dropdown': 'WORKFLOW STRATEGY',
'execution_thread_count_slider': 'EXECUTION THREAD COUNT',
'face_detector_angles_checkbox_group': 'FACE DETECTOR ANGLES',
+1 -13
View File
@@ -4,21 +4,14 @@ import gradio
import facefusion.choices
from facefusion import state_manager, translator
from facefusion.types import WorkflowMode, WorkflowStrategy
from facefusion.types import WorkflowStrategy
WORKFLOW_MODE_DROPDOWN : Optional[gradio.Dropdown] = None
WORKFLOW_STRATEGY_DROPDOWN : Optional[gradio.Dropdown] = None
def render() -> None:
global WORKFLOW_MODE_DROPDOWN
global WORKFLOW_STRATEGY_DROPDOWN
WORKFLOW_MODE_DROPDOWN = gradio.Dropdown(
label = translator.get('uis.workflow_mode_dropdown'),
choices = facefusion.choices.workflow_modes,
value = state_manager.get_item('workflow_mode')
)
WORKFLOW_STRATEGY_DROPDOWN = gradio.Dropdown(
label = translator.get('uis.workflow_strategy_dropdown'),
choices = facefusion.choices.workflow_strategies,
@@ -27,13 +20,8 @@ def render() -> None:
def listen() -> None:
WORKFLOW_MODE_DROPDOWN.change(update_workflow_mode, inputs = WORKFLOW_MODE_DROPDOWN)
WORKFLOW_STRATEGY_DROPDOWN.change(update_workflow_strategy, inputs = WORKFLOW_STRATEGY_DROPDOWN)
def update_workflow_mode(workflow_mode : WorkflowMode) -> None:
state_manager.set_item('workflow_mode', workflow_mode)
def update_workflow_strategy(workflow_strategy : WorkflowStrategy) -> None:
state_manager.set_item('workflow_strategy', workflow_strategy)