-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfaceswap.py
executable file
·33 lines (29 loc) · 1.22 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
import sys
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")
from lib.cli import FullHelpArgumentParser
from scripts.extract import ExtractTrainingData
from scripts.train import TrainingProcessor
from scripts.convert import ConvertImage
from scripts.gui import TKGui
def bad_args(args):
parser.print_help()
exit(0)
if __name__ == "__main__":
parser = FullHelpArgumentParser()
subparser = parser.add_subparsers()
extract = ExtractTrainingData(
subparser, "extract", "Extract the faces from a pictures.")
train = TrainingProcessor(
subparser, "train", "This command trains the model for the two faces A and B.")
convert = ConvertImage(
subparser, "convert", "Convert a source image to a new one with the face swapped.")
guiparsers = {'extract': extract, 'train': train, 'convert': convert}
gui = TKGui(
subparser, guiparsers, parser, "gui", "Launch the Faceswap Graphical User Interface.")
parser.set_defaults(func=bad_args)
arguments = parser.parse_args()
arguments.func(arguments)