forked from deepfakes/faceswap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
faceswap.py
executable file
·33 lines (27 loc) · 1.11 KB
/
faceswap.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python3
""" The master faceswap.py script """
import sys
import lib.cli as cli
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")
GUIPARSERS = {'extract': EXTRACT, 'train': TRAIN, 'convert': CONVERT}
GUI = cli.GuiArgs(
SUBPARSER, "gui", "Launch the Faceswap Graphical User Interface", GUIPARSERS)
PARSER.set_defaults(func=bad_args)
ARGUMENTS = PARSER.parse_args()
ARGUMENTS.func(ARGUMENTS)