File tree Expand file tree Collapse file tree 1 file changed +11
-12
lines changed
Expand file tree Collapse file tree 1 file changed +11
-12
lines changed Original file line number Diff line number Diff line change 44import time
55
66import requests
7+ from urllib .parse import urlparse
78
89from roboflow .config import API_URL , APP_URL , DEMO_KEYS , load_roboflow_api_key
910from roboflow .core .project import Project
1213
1314__version__ = "0.2.292"
1415
15-
1616def check_key (api_key , model , notebook , num_retries = 0 ):
1717 if type (api_key ) is not str :
1818 raise RuntimeError (
@@ -159,23 +159,22 @@ def train():
159159 print ("training from " + operate_workspace .name )
160160
161161
162- def load_model (project = None , version = None , local = None ):
162+ def load_model (model_url ):
163163 operate_workspace = initialize_roboflow ()
164+
165+ if "universe.roboflow.com" in model_url or "app.roboflow.com" in model_url :
166+ parsed_url = urlparse (model_url )
167+ path_parts = parsed_url .path .split ("/" )
168+ project = path_parts [2 ]
169+ version = int (path_parts [- 1 ])
170+ else :
171+ raise ("Model URL must be from either app.roboflow.com or universe.roboflow.com" )
172+
164173 project = operate_workspace .project (project )
165174 version = project .version (version )
166175 model = version .model
167176 return model
168177
169-
170- # def set_project()
171-
172- # def set_version()
173-
174- # download()
175-
176- # deploy()
177-
178-
179178# continue distributing this object for back compatibility
180179class Roboflow :
181180 def __init__ (
You can’t perform that action at this time.
0 commit comments