Skip to content

Commit

Permalink
Trace error in CLI and UI
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghassen-Chaabouni committed Dec 29, 2023
1 parent fec6308 commit e522db5
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 28 deletions.
52 changes: 28 additions & 24 deletions src/dot/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
licensed under the BSD 3-Clause "New" or "Revised" License.
"""

import traceback
from typing import Union

import click
Expand Down Expand Up @@ -51,32 +52,35 @@ def run(
use_image (bool, optional): Pass flag to use image-swap pipeline. Defaults to False.
limit (int, optional): The number of frames to process. Defaults to None.
"""
# initialize dot
_dot = DOT(use_video=use_video, use_image=use_image, save_folder=save_folder)
try:
# initialize dot
_dot = DOT(use_video=use_video, use_image=use_image, save_folder=save_folder)

# build dot
option = _dot.build_option(
swap_type=swap_type,
use_gpu=use_gpu,
gpen_type=gpen_type,
gpen_path=gpen_path,
crop_size=crop_size,
)
# build dot
option = _dot.build_option(
swap_type=swap_type,
use_gpu=use_gpu,
gpen_type=gpen_type,
gpen_path=gpen_path,
crop_size=crop_size,
)

# run dot
_dot.generate(
option=option,
source=source,
target=target,
show_fps=show_fps,
model_path=model_path,
limit=limit,
parsing_model_path=parsing_model_path,
arcface_model_path=arcface_model_path,
checkpoints_dir=checkpoints_dir,
opt_crop_size=crop_size,
head_pose=head_pose,
)
# run dot
_dot.generate(
option=option,
source=source,
target=target,
show_fps=show_fps,
model_path=model_path,
limit=limit,
parsing_model_path=parsing_model_path,
arcface_model_path=arcface_model_path,
checkpoints_dir=checkpoints_dir,
opt_crop_size=crop_size,
head_pose=head_pose,
)
except: # noqa
print(traceback.format_exc())


@click.command()
Expand Down
10 changes: 6 additions & 4 deletions src/dot/ui/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import os
import sys
import tkinter
import traceback
from pathlib import Path

import click
Expand Down Expand Up @@ -115,10 +116,10 @@ def __init__(self, *args, **kwargs):
self.textbox.insert(
"0.0",
"""
dot (aka Deepfake Offensive Toolkit) makes real-time, controllable deepfakes ready for virtual cameras injection. \n
dot is created for performing penetration testing against e.g. identity verification and video conferencing systems, \n
for the use by security analysts, Red Team members, and biometrics researchers. \n
dot is developed for research and demonstration purposes. \n
DOT (aka Deepfake Offensive Toolkit) makes real-time, controllable deepfakes ready for virtual \n
cameras injection. DOT is created for performing penetration testing against e.g. identity \n
verification and video conferencing systems, for the use by security analysts, \n
Red Team members, and biometrics researchers. DOT is developed for research and demonstration purposes. \n
As an end user, you have the responsibility to obey all applicable laws when using this program. \n
Authors and contributing developers assume no liability and are not responsible for any misuse \n
or damage caused by the use of this program.
Expand Down Expand Up @@ -821,6 +822,7 @@ def start_button_event(self, error_label):
)
except Exception as e:
print(e)
print(traceback.format_exc())
error_label.configure(text=e)


Expand Down

0 comments on commit e522db5

Please sign in to comment.