File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -101,13 +101,14 @@ def __init__(
101101
102102 version_without_workspace = os .path .basename (str (version ))
103103
104- version_info = requests .get (f"{ API_URL } /{ workspace } /{ project } /{ self .version } ?api_key={ self .__api_key } " )
105-
106- # check if version has a model
107- if version_info .status_code == 200 :
108- version_info = version_info .json ()["version" ]
104+ response = requests .get (f"{ API_URL } /{ workspace } /{ project } /{ self .version } ?api_key={ self .__api_key } " )
105+ if response .ok :
106+ version_info = response .json ()["version" ]
107+ has_model = bool (version_info .get ("models" ))
108+ else :
109+ has_model = False
109110
110- if ( "models" in version_info ) and ( not version_info [ "models" ]) :
111+ if not has_model :
111112 self .model = None
112113 elif self .type == TYPE_OBJECT_DETECTION :
113114 self .model = ObjectDetectionModel (
You can’t perform that action at this time.
0 commit comments