Add some spacing

This commit is contained in:
henryruhs
2025-01-27 10:34:06 +01:00
parent d260c28cf3
commit 5f82c8dc7d
2 changed files with 5 additions and 0 deletions

View File

@@ -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 file_names = [ file.name for file in files ] if files else None
has_source_audio = has_audio(file_names) has_source_audio = has_audio(file_names)
has_source_image = has_image(file_names) has_source_image = has_image(file_names)
if has_source_audio or has_source_image: if has_source_audio or has_source_image:
source_audio_path = get_first(filter_audio_paths(file_names)) source_audio_path = get_first(filter_audio_paths(file_names))
source_image_path = get_first(filter_image_paths(file_names)) source_image_path = get_first(filter_image_paths(file_names))
state_manager.set_item('source_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) 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') state_manager.clear_item('source_paths')
return gradio.Audio(value = None, visible = False), gradio.Image(value = None, visible = False) return gradio.Audio(value = None, visible = False), gradio.Image(value = None, visible = False)

View File

@@ -62,14 +62,17 @@ def listen() -> None:
def update(file : File) -> Tuple[gradio.Image, gradio.Video]: def update(file : File) -> Tuple[gradio.Image, gradio.Video]:
clear_reference_faces() clear_reference_faces()
clear_static_faces() clear_static_faces()
if file and is_image(file.name): if file and is_image(file.name):
state_manager.set_item('target_path', file.name) state_manager.set_item('target_path', file.name)
return gradio.Image(value = file.name, visible = True), gradio.Video(value = None, visible = False) return gradio.Image(value = file.name, visible = True), gradio.Video(value = None, visible = False)
if file and is_video(file.name): if file and is_video(file.name):
state_manager.set_item('target_path', file.name) state_manager.set_item('target_path', file.name)
if get_file_size(file.name) > FILE_SIZE_LIMIT: if get_file_size(file.name) > FILE_SIZE_LIMIT:
preview_vision_frame = normalize_frame_color(read_video_frame(file.name)) 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 = 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) return gradio.Image(value = None, visible = False), gradio.Video(value = file.name, visible = True)
state_manager.clear_item('target_path') state_manager.clear_item('target_path')
return gradio.Image(value = None, visible = False), gradio.Video(value = None, visible = False) return gradio.Image(value = None, visible = False), gradio.Video(value = None, visible = False)