Skip to content

Commit

Permalink
Merge pull request #279 from roboflow/iuri/fix-mypy-again
Browse files Browse the repository at this point in the history
Fix types in version init
  • Loading branch information
iurisilvio authored Jul 2, 2024
2 parents 813d56f + 03757f0 commit 5487639
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions roboflow/core/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,14 @@ def __init__(

version_without_workspace = os.path.basename(str(version))

version_info = requests.get(f"{API_URL}/{workspace}/{project}/{self.version}?api_key={self.__api_key}")

# check if version has a model
if version_info.status_code == 200:
version_info = version_info.json()["version"]
response = requests.get(f"{API_URL}/{workspace}/{project}/{self.version}?api_key={self.__api_key}")
if response.ok:
version_info = response.json()["version"]
has_model = bool(version_info.get("models"))
else:
has_model = False

if ("models" in version_info) and (not version_info["models"]):
if not has_model:
self.model = None
elif self.type == TYPE_OBJECT_DETECTION:
self.model = ObjectDetectionModel(
Expand Down

0 comments on commit 5487639

Please sign in to comment.