-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from SBU-BMI/dev
Add schema and expand command line program
- Loading branch information
Showing
8 changed files
with
405 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,37 @@ | ||
import os as _os | ||
|
||
import json | ||
import jsonschema | ||
from wsinfer_zoo import _version | ||
from wsinfer_zoo.client import _download_registry_if_necessary | ||
from wsinfer_zoo.client import ( | ||
_download_registry_if_necessary, | ||
ModelRegistry, | ||
WSINFER_ZOO_REGISTRY_DEFAULT_PATH, | ||
InvalidRegistryConfiguration, | ||
validate_model_zoo_json, | ||
) | ||
|
||
__version__ = _version.get_versions()["version"] | ||
|
||
if _os.getenv("WSINFER_ZOO_NO_UPDATE_REGISTRY") is None: | ||
_download_registry_if_necessary() | ||
|
||
|
||
if not WSINFER_ZOO_REGISTRY_DEFAULT_PATH.exists(): | ||
raise FileNotFoundError( | ||
f"registry file not found: {WSINFER_ZOO_REGISTRY_DEFAULT_PATH}" | ||
) | ||
with open(WSINFER_ZOO_REGISTRY_DEFAULT_PATH) as f: | ||
d = json.load(f) | ||
try: | ||
validate_model_zoo_json(d) | ||
except InvalidRegistryConfiguration as e: | ||
raise InvalidRegistryConfiguration( | ||
"Registry schema is invalid. Please contact the developer by" | ||
" creating a new issue on our GitHub page:" | ||
" https://github.com/SBU-BMI/wsinfer-zoo/issues/new." | ||
) from e | ||
|
||
registry = ModelRegistry.from_dict(d) | ||
|
||
del d, json, jsonschema |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.