@@ -178,26 +178,27 @@ def watch(self) -> None:
178178 def predict (self ) -> None :
179179 ocid = self .config ["execution" ].get ("ocid" )
180180 data = self .config ["execution" ].get ("data" )
181- if "datasciencemodeldeployment" in ocid :
182- with AuthContext (auth = self .auth_type , profile = self .profile ):
183- model_deployment = ModelDeployment .from_id (ocid )
184- return model_deployment .predict (data )
185- elif "datasciencemodel" :
186- with AuthContext (auth = self .auth_type , profile = self .profile ):
187- import tempfile
188- with tempfile .TemporaryDirectory () as td :
189-
190- model = GenericModel .from_model_catalog (ocid , artifact_dir = os .path .join (td , str (uuid .uuid4 ())), force_overwrite = True )
181+ # if "datasciencemodeldeployment" in ocid:
182+ with AuthContext (auth = self .auth_type , profile = self .profile ):
183+ model_deployment = ModelDeployment .from_id (ocid )
184+ data = json .loads (data )
185+ print (model_deployment .predict (data ))
186+ # elif "datasciencemodel":
187+ # with AuthContext(auth=self.auth_type, profile=self.profile):
188+ # import tempfile
189+ # with tempfile.TemporaryDirectory() as td:
190+
191+ # model = GenericModel.from_model_catalog(ocid, artifact_dir=os.path.join(td, str(uuid.uuid4())), force_overwrite=True)
191192
192- conda_pack = self .config ["execution" ].get ("conda" , None )
193- if not conda_pack and hasattr (model .metadata_custom , "EnvironmentType" ) and model .metadata_custom .EnvironmentType == "published" and hasattr (model .metadata_custom , "CondaEnvironmentPath" ):
194- conda_pack = model .metadata_custom .CondaEnvironmentPath
195- if conda_pack and "service-conda-packs" not in conda_pack :
196- print ("install conda pack and activate the conda pack." )
193+ # conda_pack = self.config["execution"].get("conda", None)
194+ # if not conda_pack and hasattr(model.metadata_custom, "EnvironmentType") and model.metadata_custom.EnvironmentType == "published" and hasattr(model.metadata_custom, "CondaEnvironmentPath"):
195+ # conda_pack = model.metadata_custom.CondaEnvironmentPath
196+ # if conda_pack and "service-conda-packs" not in conda_pack:
197+ # print("install conda pack and activate the conda pack.")
197198
198- data = json .loads (data )
199- print (model .verify (data ))
200- else :
201- raise ValueError ("Only model ocid or model deployment ocid is supported." )
199+ # data = json.loads(data)
200+ # print(model.verify(data))
201+ # else:
202+ # raise ValueError("Only model ocid or model deployment ocid is supported.")
202203
203204
0 commit comments