-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsample_cli.py
42 lines (36 loc) · 1.24 KB
/
sample_cli.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
34
35
36
37
38
39
40
41
42
import argparse
import sentence_mixing.logic.parameters as params
import sentence_mixing.sentence_mixer as sm
DESCRIPTION = "CLI Interface to build a sentence from a video"
SEED_HELP = f"change the seed used in phonem association's score attribution (default: {params.DEFAULT_SEED})"
TARGET_SENTENCE_HELP = "a sentence you want to hear from the video"
CONFIG_PATH_HELP = "path to the json config file"
VIDEO_URL_HELP = "a YouTube url of the wanted video"
if __name__ == "__main__":
parser = argparse.ArgumentParser(description=DESCRIPTION)
parser.add_argument(
"-s", "--seed", default=params.DEFAULT_SEED, help=SEED_HELP,
)
parser.add_argument(
"sentence",
metavar="TARGET_SENTENCE",
action="store",
help=TARGET_SENTENCE_HELP,
)
parser.add_argument(
"config_path",
metavar="CONFIG_PATH",
action="store",
help=CONFIG_PATH_HELP,
)
parser.add_argument(
"video_urls",
metavar="VIDEO_URL",
nargs="+",
action="store",
help=VIDEO_URL_HELP,
)
args = parser.parse_args()
sm.prepare_sm_config_file(args.config_path)
videos = sm.get_videos(args.video_urls)
print(sm.process_sm(args.sentence, videos, args.seed)[0])