-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtest_model.py
40 lines (32 loc) · 1.46 KB
/
test_model.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
import click
import yaml
import json
import asyncio
CONFIG = yaml.safe_load(open("config.yml"))
@click.command()
@click.option("--path", type=click.Path(), help="Path to test data CSV.")
@click.option("--data_dir", type=click.Path(), help="Path to test data CSVs directory.")
@click.option("--label", required=True, type=str, help="Label used for output.")
@click.option("--limit", type=int, show_default=True, default=100,
help="Max number of observations to test.")
@click.option("--geo/--no-geo", show_default=True, default=True,
help="Use geo model.")
@click.option("--observation_id", type=str, help="Single observation UUID to test.")
@click.option("--filter-iconic/--no-filter-iconic", show_default=True, default=True,
help="Use iconic taxon for filtering.")
@click.option("--debug", is_flag=True, show_default=True, default=False,
help="Output debug messages.")
def test(**args):
if not args["path"] and not args["data_dir"]:
print("\nYou must specify either a `--path` or a `--data_dir` option\n")
exit()
# some libraries are slow to import, so wait until command is validated and properly invoked
from lib.vision_testing import VisionTesting
print("\nArguments:")
print(json.dumps(args, indent=4))
print("\nInitializing VisionTesting...\n")
testing = VisionTesting(CONFIG, **args)
asyncio.run(testing.run_async())
print("\nDone\n")
if __name__ == "__main__":
test()