Compare commits

..

9 Commits

Author SHA1 Message Date
qitianai b3e73956d2
Merge 693c9bb268 into aed933c1db 2025-01-06 23:39:42 -08:00
qitianai 693c9bb268
Merge pull request #1 from hacksider/main
merge from source main branch
2025-01-07 15:01:00 +08:00
qitian 5132f86cdc add mutil language 2025-01-07 14:04:18 +08:00
Kenneth Estanislao cab2efa200
Update README.md
added qitianai on the credits
2025-01-07 13:48:42 +08:00
qitian 6e29e4061b merge from the source and little change 2025-01-07 13:46:17 +08:00
KRSHH 2a7ae010a8
Raised img Res 2025-01-06 23:53:18 +05:30
KRSHH a834811974
Add URL to buttons
Forgot to add before (regarded)
2025-01-06 23:23:19 +05:30
KRSHH d2aaf46e69
Change buttons 2025-01-06 23:13:57 +05:30
Makaru d07d4a6a26 Update ui.py
I pushed it to premain
2025-01-07 01:15:05 +08:00
4 changed files with 92 additions and 46 deletions

View File

@ -20,20 +20,15 @@
###### 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 - Download Prebuilt
<div style="margin: 28px 0;">
<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;">
## Quick Start - Pre-built
<div align="center">
<a href="https://hacksider.gumroad.com/l/vccdmm">
<img src="https://github.com/user-attachments/assets/7d993b32-e3e8-4cd3-bbfb-a549152ebdd5" width="285" height="77" />
</a>
</div>
<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 href="https://krshh.gumroad.com/l/Deep-Live-Cam-Mac">
<img src="https://github.com/user-attachments/assets/d5d913b5-a7de-4609-96b9-979a5749a703" width="285" height="77" />
</a>
</div>
</div>
## Features - Everything is real-time
@ -261,6 +256,7 @@ Looking for a CLI mode? Using the -s/--source argument will make the run program
- [pereiraroland26](https://github.com/pereiraroland26): Multiple faces support
- [vic4key](https://github.com/vic4key): For supporting/contributing to this project
- [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.
- 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 ❤️

View File

@ -31,11 +31,16 @@
"Please select a source image first": "请先选择一个源图像",
"No faces found in target": "目标图像中没有人脸",
"Add": "添加",
"Clear": "清除",
"Submit": "确认",
"Select source image": "请选取源图像",
"Select target image": "请选取目标图像",
"Please provide mapping!": "请提供映射",
"Atleast 1 source with target is required!": "至少需要一个来源图像与目标图像相关!",
"At least 1 source with target is required!": "至少需要一个来源图像与目标图像相关!",
"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,6 +266,7 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
command=lambda: (
setattr(modules.globals, "map_faces", map_faces.get()),
save_switch_states(),
close_mapper_window() if not map_faces.get() else None
),
)
map_faces_switch.place(relx=0.1, rely=0.75)
@ -380,26 +381,35 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
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):
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
if modules.globals.map_faces:
modules.globals.souce_target_map = []
if is_image(modules.globals.target_path):
update_status(_("Getting unique faces"))
update_status("Getting unique faces")
get_unique_faces_from_target_image()
elif is_video(modules.globals.target_path):
update_status(_("Getting unique faces"))
update_status("Getting unique faces")
get_unique_faces_from_target_video()
if len(modules.globals.souce_target_map) > 0:
create_source_target_popup(start, root, modules.globals.souce_target_map)
else:
update_status(_("No faces found in target"))
update_status("No faces found in target")
else:
select_output_path(start)
@ -521,7 +531,7 @@ def update_popup_source(
source_image.configure(image=tk_image)
source_label_dict[button_num] = source_image
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
@ -679,7 +689,7 @@ def check_and_ignore_nsfw(target, destroy: Callable = None) -> bool:
destroy(
to_quit=False
) # Do not need to destroy the window frame if the target is NSFW
update_status(_("Processing ignored!"))
update_status("Processing ignored!")
return True
else:
return False
@ -743,7 +753,7 @@ def init_preview() -> None:
def update_preview(frame_number: int = 0) -> None:
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)
if modules.globals.nsfw_filter and check_and_ignore_nsfw(temp_frame):
return
@ -759,14 +769,21 @@ def update_preview(frame_number: int = 0) -> None:
)
image = ctk.CTkImage(image, size=image.size)
preview_label.configure(image=image)
update_status(_("Processing succeed!"))
update_status("Processing succeed!")
PREVIEW.deiconify()
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 modules.globals.source_path is None:
update_status(_("Please select a source image first"))
update_status("Please select a source image first")
return
create_webcam_preview(camera_index)
else:
@ -776,6 +793,7 @@ def webcam_preview(root: ctk.CTk, camera_index: int):
)
def get_available_cameras():
"""Returns a list of available camera names and indices."""
if platform.system() == "Windows":
@ -851,7 +869,7 @@ def create_webcam_preview(camera_index: int):
cap = VideoCapturer(camera_index)
if not cap.start(PREVIEW_DEFAULT_WIDTH, PREVIEW_DEFAULT_HEIGHT, 60):
update_status(_("Failed to start camera"))
update_status("Failed to start camera")
return
preview_label.configure(width=PREVIEW_DEFAULT_WIDTH, height=PREVIEW_DEFAULT_HEIGHT)
@ -950,27 +968,54 @@ def create_source_target_popup_for_webcam(
def on_submit_click():
if has_valid_map():
POPUP_LIVE.destroy()
simplify_maps()
create_webcam_preview(camera_index)
update_pop_live_status("Mappings successfully submitted!")
create_webcam_preview(camera_index) # Open the preview window
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():
add_blank_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.grid(row=1, column=0, pady=15)
add_button = ctk.CTkButton(POPUP_LIVE, text=_("Add"), command=lambda: on_add_click())
add_button.place(relx=0.2, rely=0.92, relwidth=0.2, relheight=0.05)
add_button.place(relx=0.1, 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(
POPUP_LIVE, text=_("Submit"), command=lambda: on_submit_click()
)
close_button.place(relx=0.6, rely=0.92, relwidth=0.2, relheight=0.05)
close_button.place(relx=0.7, 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):
@ -1101,7 +1146,7 @@ def update_webcam_source(
source_image.configure(image=tk_image)
source_label_dict_live[button_num] = source_image
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
@ -1153,5 +1198,5 @@ def update_webcam_target(
target_image.configure(image=tk_image)
target_label_dict_live[button_num] = target_image
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