Skip to content

Industry leading face manipulation platform

Add some spacing

henryruhs5f82c8dc7da5
diff --git a/facefusion/uis/components/source.py b/facefusion/uis/components/source.py
index 07621663..70e852a0 100644
--- a/facefusion/uis/components/source.py
+++ b/facefusion/uis/components/source.py
@@ -50,10 +50,12 @@ def update(files : List[File]) -> Tuple[gradio.Audio, gradio.Image]:
file_names = [ file.name for file in files ] if files else None
has_source_audio = has_audio(file_names)
has_source_image = has_image(file_names)
+
if has_source_audio or has_source_image:
source_audio_path = get_first(filter_audio_paths(file_names))
source_image_path = get_first(filter_image_paths(file_names))
state_manager.set_item('source_paths', file_names)
return gradio.Audio(value = source_audio_path, visible = has_source_audio), gradio.Image(value = source_image_path, visible = has_source_image)
+
state_manager.clear_item('source_paths')
return gradio.Audio(value = None, visible = False), gradio.Image(value = None, visible = False)
diff --git a/facefusion/uis/components/target.py b/facefusion/uis/components/target.py
index d3664a03..9d371e3a 100644
--- a/facefusion/uis/components/target.py
+++ b/facefusion/uis/components/target.py
@@ -62,14 +62,17 @@ def listen() -> None:
def update(file : File) -> Tuple[gradio.Image, gradio.Video]:
clear_reference_faces()
clear_static_faces()
+
if file and is_image(file.name):
state_manager.set_item('target_path', file.name)
return gradio.Image(value = file.name, visible = True), gradio.Video(value = None, visible = False)
+
if file and is_video(file.name):
state_manager.set_item('target_path', file.name)
if get_file_size(file.name) > FILE_SIZE_LIMIT:
preview_vision_frame = normalize_frame_color(read_video_frame(file.name))
return gradio.Image(value = preview_vision_frame, visible = True), gradio.Video(value = None, visible = False)
return gradio.Image(value = None, visible = False), gradio.Video(value = file.name, visible = True)
+
state_manager.clear_item('target_path')
return gradio.Image(value = None, visible = False), gradio.Video(value = None, visible = False)