@@ -573,39 +573,38 @@ def deploy_model(
573573 self ,
574574 model_type : str ,
575575 model_path : str ,
576- project_urls : list [str ],
576+ project_ids : list [str ],
577577 filename : str = "weights/best.pt" ,
578578 ):
579579 """Uploads provided weights file to Roboflow.
580580
581581 Args:
582582 model_type (str): The type of the model to be deployed.
583583 model_path (str): File path to the model weights to be uploaded.
584- project_urls (list[str]): List of project URLs to deploy the model to.
584+ project_ids (list[str]): List of project IDs to deploy the model to.
585585 filename (str, optional): The name of the weights file. Defaults to "weights/best.pt".
586586 """
587587
588- if not project_urls :
589- raise ValueError ("At least one project URL must be provided" )
588+ if not project_ids :
589+ raise ValueError ("At least one project ID must be provided" )
590590
591591 # Validate if provided project URLs belong to user's projects
592- user_projects = set (self .projects ())
593- for project_url in project_urls :
594- project_id = project_url .split ("/" )[- 1 ]
592+ user_projects = set (p .id for p in self .projects ())
593+ for project_id in project_ids :
595594 if project_id not in user_projects :
596- raise ValueError (f"Project { project_url } is not accessible in this workspace" )
595+ raise ValueError (f"Project { project_id } is not accessible in this workspace" )
597596
598597 zip_file_name = process (model_type , model_path , filename )
599598
600599 if zip_file_name is None :
601600 raise RuntimeError ("Failed to process model" )
602601
603- self ._upload_zip (model_type , model_path , project_urls , zip_file_name )
602+ self ._upload_zip (model_type , model_path , project_ids , zip_file_name )
604603
605- def _upload_zip (self , model_type : str , model_path : str , project_urls : list [str ], model_file_name : str ):
604+ def _upload_zip (self , model_type : str , model_path : str , project_ids : list [str ], model_file_name : str ):
606605 # TODO: Need to create this endpoint
607606 res = requests .post (
608- f"{ API_URL } /{ self .url } /uploadModel?api_key={ self .__api_key } &modelType={ model_type } &project_urls ={ ',' .join (project_urls )} &nocache=true"
607+ f"{ API_URL } /{ self .url } /uploadModel?api_key={ self .__api_key } &modelType={ model_type } &project_ids ={ ',' .join (project_ids )} &nocache=true"
609608 )
610609 try :
611610 res .raise_for_status ()
0 commit comments