Respect the trim frame args on UI launch
This commit is contained in:
parent
d8d607cb23
commit
09c2fb2f46
@ -21,21 +21,20 @@ def render() -> None:
|
|||||||
with gradio.Box():
|
with gradio.Box():
|
||||||
trim_frame_start_slider_args : Dict[str, Any] = {
|
trim_frame_start_slider_args : Dict[str, Any] = {
|
||||||
'label': wording.get('trim_frame_start_slider_label'),
|
'label': wording.get('trim_frame_start_slider_label'),
|
||||||
'value': facefusion.globals.trim_frame_start,
|
|
||||||
'step': 1,
|
'step': 1,
|
||||||
'visible': False
|
'visible': False
|
||||||
}
|
}
|
||||||
trim_frame_end_slider_args : Dict[str, Any] = {
|
trim_frame_end_slider_args : Dict[str, Any] = {
|
||||||
'label': wording.get('trim_frame_end_slider_label'),
|
'label': wording.get('trim_frame_end_slider_label'),
|
||||||
'value': facefusion.globals.trim_frame_end,
|
|
||||||
'step': 1,
|
'step': 1,
|
||||||
'visible': False
|
'visible': False
|
||||||
}
|
}
|
||||||
if is_video(facefusion.globals.target_path):
|
if is_video(facefusion.globals.target_path):
|
||||||
video_frame_total = get_video_frame_total(facefusion.globals.target_path)
|
video_frame_total = get_video_frame_total(facefusion.globals.target_path)
|
||||||
|
trim_frame_start_slider_args['value'] = facefusion.globals.trim_frame_start or 0
|
||||||
trim_frame_start_slider_args['maximum'] = video_frame_total
|
trim_frame_start_slider_args['maximum'] = video_frame_total
|
||||||
trim_frame_start_slider_args['visible'] = True
|
trim_frame_start_slider_args['visible'] = True
|
||||||
trim_frame_end_slider_args['value'] = video_frame_total
|
trim_frame_end_slider_args['value'] = facefusion.globals.trim_frame_end or video_frame_total
|
||||||
trim_frame_end_slider_args['maximum'] = video_frame_total
|
trim_frame_end_slider_args['maximum'] = video_frame_total
|
||||||
trim_frame_end_slider_args['visible'] = True
|
trim_frame_end_slider_args['visible'] = True
|
||||||
with gradio.Row():
|
with gradio.Row():
|
||||||
|
@ -71,11 +71,11 @@ def test_extract_frames_with_trim_start() -> None:
|
|||||||
|
|
||||||
|
|
||||||
def test_extract_frames_with_trim_start_and_trim_end() -> None:
|
def test_extract_frames_with_trim_start_and_trim_end() -> None:
|
||||||
facefusion.globals.trim_frame_start = 224
|
facefusion.globals.trim_frame_start = 124
|
||||||
facefusion.globals.trim_frame_end = 324
|
facefusion.globals.trim_frame_end = 224
|
||||||
data_provider =\
|
data_provider =\
|
||||||
[
|
[
|
||||||
('.assets/examples/target-240p-25fps.mp4', 55),
|
('.assets/examples/target-240p-25fps.mp4', 120),
|
||||||
('.assets/examples/target-240p-30fps.mp4', 100),
|
('.assets/examples/target-240p-30fps.mp4', 100),
|
||||||
('.assets/examples/target-240p-60fps.mp4', 50)
|
('.assets/examples/target-240p-60fps.mp4', 50)
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user