-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_input_args.py
32 lines (29 loc) · 1.41 KB
/
get_input_args.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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# */AIPND-revision/intropyproject-classify-pet-images/get_input_args.py
import argparse
def get_input_args():
"""
Retrieves and parses the 3 command line arguments provided by the user when
they run the program from a terminal window. This function uses Python's
argparse module to created and defined these 3 command line arguments. If
the user fails to provide some or all of the 3 arguments, then the default
values are used for the missing arguments.
Command Line Arguments:
1. Image Folder as --dir with default value 'pet_images'
2. CNN Model Architecture as --arch with default value 'vgg'
3. Text File with Dog Names as --dogfile with default value 'dognames.txt'
This function returns these arguments as an ArgumentParser object.
Parameters:
None - simply using argparse module to create & store command line arguments
Returns:
parse_args() -data structure that stores the command line arguments object
"""
parser = argparse.ArgumentParser()
parser.add_argument('--dir', type=str, default='pet_images',
help='image folder')
parser.add_argument('--arch', type=str, default='vgg',
help='image folder')
parser.add_argument('--dogfile', type=str, default='dognames.txt',
help='image folder')
return parser.parse_args()