-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain_arg_parser.py
More file actions
51 lines (40 loc) · 1.52 KB
/
Copy pathmain_arg_parser.py
File metadata and controls
51 lines (40 loc) · 1.52 KB
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
43
44
45
46
47
48
49
50
51
### refer this ---> https://gist.github.com/namoopsoo/154c97ef4fa0d36a4daffeeb0d1affd5
import os
import sys
import argparse
import logging
from utils.file_utils import check_search_file, get_classes_to_download
from gooey import Gooey, GooeyParser
from pexels.pexels import download_pexel_images
from bing.bing import bing_downloader
from settings import pexels_auth_code
# @Gooey()
def main():
# parser =
parser = argparse.ArgumentParser()
parser.add_argument("--SOURCES", action="store_true")
parser.add_argument("--IMAGES_PER_CLASS", type=int, default=50)
parser.add_argument("--OUTPUT_LOCATION","-o",default="user_files/temp")
# parser = GooeyParser(description="My Cool GUI Program!")
args = parser.parse_args()
# print(args.use_pexels)
categories = args.CATEGORIES.strip(" ").split(",")
if not os.path.exists(args.OUTPUT_LOCATION):
os.makedirs(args.OUTPUT_LOCATION)
if "Pexels" in args.SOURCES:
download_pexel_images(
auth_code=pexels_auth_code,
output_loc=args.OUTPUT_LOCATION,
n_images_per_class=args.IMAGES_PER_CLASS,
categories=categories,
)
if "Bing" in args.SOURCES:
bing_downloader(
categories,
n_images_per_category=int(args.IMAGES_PER_CLASS),
output_dir=args.OUTPUT_LOCATION,
)
if "Pixabay" in args.SOURCES:
download_pixabay_images(pixabay_api_code, categories, args.IMAGES_PER_CLASS, args.OUTPUT_LOCATION)
if __name__ == "__main__":
main()