-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathapp.py
31 lines (28 loc) · 1.06 KB
/
app.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
import sys
import yaml
import os
sys.path.append("./lib")
from inat_vision_api import InatVisionAPI # noqa: E402
if "APP_SECRET" in os.environ:
CONFIG = {
"app_secret": os.environ["APP_SECRET"],
"models": [{
"name": os.environ["MODEL_NAME"],
"vision_model_path": os.environ["VISION_MODEL_PATH"],
"taxonomy_path": os.environ["TAXONOMY_PATH"],
"tf_geo_elevation_model_path": os.environ["TF_GEO_MODEL_PATH"],
"elevation_h3_r4": os.environ["ELEVATION_H3_R4_PATH"],
"tf_elev_thresholds": os.environ["GEO_THRESHOLDS_PATH"],
"taxon_ranges_path": os.environ["TAXON_RANGES_PATH"],
"synonyms_path": os.environ["SYNONYMS_PATH"],
"synonyms_taxonomy_path": os.environ["SYNONYMS_TAXONOMY_PATH"]
}]
}
if "GEO_MIN" in os.environ:
CONFIG["models"][0]["geo_min"] = os.environ["GEO_MIN"]
else:
CONFIG = yaml.safe_load(open("config.yml"))
api = InatVisionAPI(CONFIG)
app = api.app
if __name__ == "__main__":
app.run(host="0.0.0.0", port=6006)