Compare commits

..

3 Commits

Author SHA1 Message Date
qitianai 20637d3c27
Merge 01393ec77b into aed933c1db 2025-01-06 15:36:05 +00:00
qitian 01393ec77b fix: Default en 2025-01-06 23:34:29 +08:00
qitian 85a52e92b2 feat: Add Multi-language Support with Chinese UI 2025-01-06 22:45:08 +08:00
4 changed files with 46 additions and 92 deletions

View File

@ -20,14 +20,19 @@
###### Users are expected to use this software responsibly and legally. If using a real person's face, obtain their consent and clearly label any output as a deepfake when sharing online. We are not responsible for end-user actions. ###### Users are expected to use this software responsibly and legally. If using a real person's face, obtain their consent and clearly label any output as a deepfake when sharing online. We are not responsible for end-user actions.
## Quick Start - Pre-built ## Quick Start - Download Prebuilt
<div align="center">
<a href="https://hacksider.gumroad.com/l/vccdmm"> <div style="margin: 28px 0;">
<img src="https://github.com/user-attachments/assets/7d993b32-e3e8-4cd3-bbfb-a549152ebdd5" width="285" height="77" /> <div style="margin-bottom: 20px;">
<a href="https://hacksider.gumroad.com/l/vccdmm" target="_blank">
<img src="https://github.com/user-attachments/assets/c702bb7d-d9c0-466a-9ad2-02849294e540" alt="Download Button 1" style="width: 280px; display: block;">
</a> </a>
<a href="https://krshh.gumroad.com/l/Deep-Live-Cam-Mac"> </div>
<img src="https://github.com/user-attachments/assets/d5d913b5-a7de-4609-96b9-979a5749a703" width="285" height="77" /> <div>
<a href="https://krshh.gumroad.com/l/Deep-Live-Cam-Mac" target="_blank">
<img src="https://github.com/user-attachments/assets/9a302750-2d54-457d-bdc8-6ed7c6af0e1a" alt="Download Button 2" style="width: 280px; display: block;">
</a> </a>
</div>
</div> </div>
## Features - Everything is real-time ## Features - Everything is real-time
@ -256,7 +261,6 @@ Looking for a CLI mode? Using the -s/--source argument will make the run program
- [pereiraroland26](https://github.com/pereiraroland26): Multiple faces support - [pereiraroland26](https://github.com/pereiraroland26): Multiple faces support
- [vic4key](https://github.com/vic4key): For supporting/contributing to this project - [vic4key](https://github.com/vic4key): For supporting/contributing to this project
- [kier007](https://github.com/kier007): for improving the user experience - [kier007](https://github.com/kier007): for improving the user experience
- [qitianai](https://github.com/qitianai): for multi-lingual support
- and [all developers](https://github.com/hacksider/Deep-Live-Cam/graphs/contributors) behind libraries used in this project. - and [all developers](https://github.com/hacksider/Deep-Live-Cam/graphs/contributors) behind libraries used in this project.
- Footnote: Please be informed that the base author of the code is [s0md3v](https://github.com/s0md3v/roop) - Footnote: Please be informed that the base author of the code is [s0md3v](https://github.com/s0md3v/roop)
- All the wonderful users who helped make this project go viral by starring the repo ❤️ - All the wonderful users who helped make this project go viral by starring the repo ❤️

View File

@ -31,16 +31,11 @@
"Please select a source image first": "请先选择一个源图像", "Please select a source image first": "请先选择一个源图像",
"No faces found in target": "目标图像中没有人脸", "No faces found in target": "目标图像中没有人脸",
"Add": "添加", "Add": "添加",
"Clear": "清除",
"Submit": "确认", "Submit": "确认",
"Select source image": "请选取源图像", "Select source image": "请选取源图像",
"Select target image": "请选取目标图像", "Select target image": "请选取目标图像",
"Please provide mapping!": "请提供映射", "Please provide mapping!": "请提供映射",
"Atleast 1 source with target is required!": "至少需要一个来源图像与目标图像相关!",
"At least 1 source with target is required!": "至少需要一个来源图像与目标图像相关!", "At least 1 source with target is required!": "至少需要一个来源图像与目标图像相关!",
"Face could not be detected in last upload!": "最近上传的图像中没有检测到人脸!", "Face could not be detected in last upload!": "最近上传的图像中没有检测到人脸!",
"Select Camera:": "选择摄像头", "Select Camera:": "选择摄像头"
"All mappings cleared!": "所有映射均已清除!",
"Mappings successfully submitted!": "成功提交映射!",
"Source x Target Mapper is already open.": "源 x 目标映射器已打开。"
} }

View File

@ -266,7 +266,6 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
command=lambda: ( command=lambda: (
setattr(modules.globals, "map_faces", map_faces.get()), setattr(modules.globals, "map_faces", map_faces.get()),
save_switch_states(), save_switch_states(),
close_mapper_window() if not map_faces.get() else None
), ),
) )
map_faces_switch.place(relx=0.1, rely=0.75) map_faces_switch.place(relx=0.1, rely=0.75)
@ -381,35 +380,26 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
return root return root
def close_mapper_window():
global POPUP, POPUP_LIVE
if POPUP and POPUP.winfo_exists():
POPUP.destroy()
POPUP = None
if POPUP_LIVE and POPUP_LIVE.winfo_exists():
POPUP_LIVE.destroy()
POPUP_LIVE = None
def analyze_target(start: Callable[[], None], root: ctk.CTk): def analyze_target(start: Callable[[], None], root: ctk.CTk):
if POPUP != None and POPUP.winfo_exists(): if POPUP != None and POPUP.winfo_exists():
update_status("Please complete pop-up or close it.") update_status(_("Please complete pop-up or close it."))
return return
if modules.globals.map_faces: if modules.globals.map_faces:
modules.globals.souce_target_map = [] modules.globals.souce_target_map = []
if is_image(modules.globals.target_path): if is_image(modules.globals.target_path):
update_status("Getting unique faces") update_status(_("Getting unique faces"))
get_unique_faces_from_target_image() get_unique_faces_from_target_image()
elif is_video(modules.globals.target_path): elif is_video(modules.globals.target_path):
update_status("Getting unique faces") update_status(_("Getting unique faces"))
get_unique_faces_from_target_video() get_unique_faces_from_target_video()
if len(modules.globals.souce_target_map) > 0: if len(modules.globals.souce_target_map) > 0:
create_source_target_popup(start, root, modules.globals.souce_target_map) create_source_target_popup(start, root, modules.globals.souce_target_map)
else: else:
update_status("No faces found in target") update_status(_("No faces found in target"))
else: else:
select_output_path(start) select_output_path(start)
@ -509,7 +499,7 @@ def update_popup_source(
x_min, y_min, x_max, y_max = face["bbox"] x_min, y_min, x_max, y_max = face["bbox"]
map[button_num]["source"] = { map[button_num]["source"] = {
"cv2": cv2_img[int(y_min): int(y_max), int(x_min): int(x_max)], "cv2": cv2_img[int(y_min) : int(y_max), int(x_min) : int(x_max)],
"face": face, "face": face,
} }
@ -531,7 +521,7 @@ def update_popup_source(
source_image.configure(image=tk_image) source_image.configure(image=tk_image)
source_label_dict[button_num] = source_image source_label_dict[button_num] = source_image
else: else:
update_pop_status("Face could not be detected in last upload!") update_pop_status(_("Face could not be detected in last upload!"))
return map return map
@ -689,7 +679,7 @@ def check_and_ignore_nsfw(target, destroy: Callable = None) -> bool:
destroy( destroy(
to_quit=False to_quit=False
) # Do not need to destroy the window frame if the target is NSFW ) # Do not need to destroy the window frame if the target is NSFW
update_status("Processing ignored!") update_status(_("Processing ignored!"))
return True return True
else: else:
return False return False
@ -753,7 +743,7 @@ def init_preview() -> None:
def update_preview(frame_number: int = 0) -> None: def update_preview(frame_number: int = 0) -> None:
if modules.globals.source_path and modules.globals.target_path: if modules.globals.source_path and modules.globals.target_path:
update_status("Processing...") update_status(_("Processing..."))
temp_frame = get_video_frame(modules.globals.target_path, frame_number) temp_frame = get_video_frame(modules.globals.target_path, frame_number)
if modules.globals.nsfw_filter and check_and_ignore_nsfw(temp_frame): if modules.globals.nsfw_filter and check_and_ignore_nsfw(temp_frame):
return return
@ -769,21 +759,14 @@ def update_preview(frame_number: int = 0) -> None:
) )
image = ctk.CTkImage(image, size=image.size) image = ctk.CTkImage(image, size=image.size)
preview_label.configure(image=image) preview_label.configure(image=image)
update_status("Processing succeed!") update_status(_("Processing succeed!"))
PREVIEW.deiconify() PREVIEW.deiconify()
def webcam_preview(root: ctk.CTk, camera_index: int): def webcam_preview(root: ctk.CTk, camera_index: int):
global POPUP_LIVE
if POPUP_LIVE and POPUP_LIVE.winfo_exists():
update_status("Source x Target Mapper is already open.")
POPUP_LIVE.focus()
return
if not modules.globals.map_faces: if not modules.globals.map_faces:
if modules.globals.source_path is None: if modules.globals.source_path is None:
update_status("Please select a source image first") update_status(_("Please select a source image first"))
return return
create_webcam_preview(camera_index) create_webcam_preview(camera_index)
else: else:
@ -793,7 +776,6 @@ def webcam_preview(root: ctk.CTk, camera_index: int):
) )
def get_available_cameras(): def get_available_cameras():
"""Returns a list of available camera names and indices.""" """Returns a list of available camera names and indices."""
if platform.system() == "Windows": if platform.system() == "Windows":
@ -869,7 +851,7 @@ def create_webcam_preview(camera_index: int):
cap = VideoCapturer(camera_index) cap = VideoCapturer(camera_index)
if not cap.start(PREVIEW_DEFAULT_WIDTH, PREVIEW_DEFAULT_HEIGHT, 60): if not cap.start(PREVIEW_DEFAULT_WIDTH, PREVIEW_DEFAULT_HEIGHT, 60):
update_status("Failed to start camera") update_status(_("Failed to start camera"))
return return
preview_label.configure(width=PREVIEW_DEFAULT_WIDTH, height=PREVIEW_DEFAULT_HEIGHT) preview_label.configure(width=PREVIEW_DEFAULT_WIDTH, height=PREVIEW_DEFAULT_HEIGHT)
@ -968,54 +950,27 @@ def create_source_target_popup_for_webcam(
def on_submit_click(): def on_submit_click():
if has_valid_map(): if has_valid_map():
POPUP_LIVE.destroy()
simplify_maps() simplify_maps()
update_pop_live_status("Mappings successfully submitted!") create_webcam_preview(camera_index)
create_webcam_preview(camera_index) # Open the preview window
else: else:
update_pop_live_status("At least 1 source with target is required!") update_pop_live_status(_("At least 1 source with target is required!"))
def on_add_click(): def on_add_click():
add_blank_map() add_blank_map()
refresh_data(map) refresh_data(map)
update_pop_live_status("Please provide mapping!") update_pop_live_status(_("Please provide mapping!"))
def on_clear_click():
clear_source_target_images(map)
refresh_data(map)
update_pop_live_status("All mappings cleared!")
popup_status_label_live = ctk.CTkLabel(POPUP_LIVE, text=None, justify="center") popup_status_label_live = ctk.CTkLabel(POPUP_LIVE, text=None, justify="center")
popup_status_label_live.grid(row=1, column=0, pady=15) popup_status_label_live.grid(row=1, column=0, pady=15)
add_button = ctk.CTkButton(POPUP_LIVE, text=_("Add"), command=lambda: on_add_click()) add_button = ctk.CTkButton(POPUP_LIVE, text=_("Add"), command=lambda: on_add_click())
add_button.place(relx=0.1, rely=0.92, relwidth=0.2, relheight=0.05) add_button.place(relx=0.2, rely=0.92, relwidth=0.2, relheight=0.05)
clear_button = ctk.CTkButton(POPUP_LIVE, text=_("Clear"), command=lambda: on_clear_click())
clear_button.place(relx=0.4, rely=0.92, relwidth=0.2, relheight=0.05)
close_button = ctk.CTkButton( close_button = ctk.CTkButton(
POPUP_LIVE, text=_("Submit"), command=lambda: on_submit_click() POPUP_LIVE, text=_("Submit"), command=lambda: on_submit_click()
) )
close_button.place(relx=0.7, rely=0.92, relwidth=0.2, relheight=0.05) close_button.place(relx=0.6, rely=0.92, relwidth=0.2, relheight=0.05)
def clear_source_target_images(map: list):
global source_label_dict_live, target_label_dict_live
for item in map:
if "source" in item:
del item["source"]
if "target" in item:
del item["target"]
for button_num in list(source_label_dict_live.keys()):
source_label_dict_live[button_num].destroy()
del source_label_dict_live[button_num]
for button_num in list(target_label_dict_live.keys()):
target_label_dict_live[button_num].destroy()
del target_label_dict_live[button_num]
def refresh_data(map: list): def refresh_data(map: list):
@ -1124,7 +1079,7 @@ def update_webcam_source(
x_min, y_min, x_max, y_max = face["bbox"] x_min, y_min, x_max, y_max = face["bbox"]
map[button_num]["source"] = { map[button_num]["source"] = {
"cv2": cv2_img[int(y_min): int(y_max), int(x_min): int(x_max)], "cv2": cv2_img[int(y_min) : int(y_max), int(x_min) : int(x_max)],
"face": face, "face": face,
} }
@ -1146,7 +1101,7 @@ def update_webcam_source(
source_image.configure(image=tk_image) source_image.configure(image=tk_image)
source_label_dict_live[button_num] = source_image source_label_dict_live[button_num] = source_image
else: else:
update_pop_live_status("Face could not be detected in last upload!") update_pop_live_status(_("Face could not be detected in last upload!"))
return map return map
@ -1176,7 +1131,7 @@ def update_webcam_target(
x_min, y_min, x_max, y_max = face["bbox"] x_min, y_min, x_max, y_max = face["bbox"]
map[button_num]["target"] = { map[button_num]["target"] = {
"cv2": cv2_img[int(y_min): int(y_max), int(x_min): int(x_max)], "cv2": cv2_img[int(y_min) : int(y_max), int(x_min) : int(x_max)],
"face": face, "face": face,
} }
@ -1198,5 +1153,5 @@ def update_webcam_target(
target_image.configure(image=tk_image) target_image.configure(image=tk_image)
target_label_dict_live[button_num] = target_image target_label_dict_live[button_num] = target_image
else: else:
update_pop_live_status("Face could not be detected in last upload!") update_pop_live_status(_("Face could not be detected in last upload!"))
return map return map