Example #1
0
 def _run_script(self, args_str):
     PARSER = cli.FullHelpArgumentParser()
     SUBPARSER = PARSER.add_subparsers()
     EXTRACT = cli.ExtractArgs(SUBPARSER, "extract",
                               "Extract the faces from pictures")
     TRAIN = cli.TrainArgs(
         SUBPARSER, "train",
         "This command trains the model for the two faces A and B")
     CONVERT = cli.ConvertArgs(
         SUBPARSER, "convert",
         "Convert a source image to a new one with the face swapped")
     GUI = cli.GuiArgs(SUBPARSER, "gui",
                       "Launch the Faceswap Graphical User Interface")
     PARSER.set_defaults(func=self.bad_args)
     ARGUMENTS = PARSER.parse_args(args_str.split(' '))
     ARGUMENTS.func(ARGUMENTS)
Example #2
0
os.environ["CUDA_VISIBLE_DEVICES"] = "0"

if sys.version_info[0] < 3:
    raise Exception("This program requires at least python3.2")
if sys.version_info[0] == 3 and sys.version_info[1] < 2:
    raise Exception("This program requires at least python3.2")


def bad_args(args):
    """ Print help on bad arguments """
    PARSER.print_help()
    exit(0)


if __name__ == "__main__":
    PARSER = cli.FullHelpArgumentParser()
    SUBPARSER = PARSER.add_subparsers()
    EXTRACT = cli.ExtractArgs(SUBPARSER, "extract",
                              "Extract the faces from pictures")
    TRAIN = cli.TrainArgs(
        SUBPARSER, "train",
        "This command trains the model for the two faces A and B")
    CONVERT = cli.ConvertArgs(
        SUBPARSER, "convert",
        "Convert a source image to a new one with the face swapped")
    GUI = cli.GuiArgs(SUBPARSER, "gui",
                      "Launch the Faceswap Graphical User Interface")
    PARSER.set_defaults(func=bad_args)
    ARGUMENTS = PARSER.parse_args()
    ARGUMENTS.func(ARGUMENTS)
Example #3
0
if sys.version_info[0] == 3 and sys.version_info[1] < 2:
    raise Exception("This program requires at least python3.2")


def bad_args(args):
    PARSER.print_help()
    exit(0)


if __name__ == "__main__":
    _tools_warning = "Please backup your data and/or test the tool you want "
    _tools_warning += "to use with a smaller data set to make sure you "
    _tools_warning += "understand how it works."
    print(_tools_warning)

    PARSER = cli.FullHelpArgumentParser()
    SUBPARSER = PARSER.add_subparsers()
    EFFMPEG = Effmpeg(
            SUBPARSER, "effmpeg",
            "This command allows you to easily execute common ffmpeg tasks.")
    SORT = SortProcessor(
            SUBPARSER, "sort",
            "This command lets you sort images using various methods.")
    GUIPARSERS = {'effmpeg': EFFMPEG, 'sort': SORT}
    GUI = cli.GuiArgs(
            SUBPARSER, "gui",
            "Launch the Faceswap Tools Graphical User Interface.", GUIPARSERS)
    PARSER.set_defaults(func=bad_args)
    ARGUMENTS = PARSER.parse_args()
    ARGUMENTS.func(ARGUMENTS)