@@ -103,7 +103,6 @@ Deploy and Generate Endpoint
103103 ... deployment_predict_log_id="ocid1.log.oc1.xxx.xxxxx",
104104 ... )
105105 >>> print(f"Endpoint: {huggingface_pipeline_model.model_deployment.url}")
106- https://modeldeployment.{region}.oci.customer-oci.com/ocid1.datasciencemodeldeployment.oc1.xxx.xxxxx
107106
108107 Run Prediction against Endpoint
109108===============================
@@ -115,9 +114,7 @@ Run Prediction against Endpoint
115114 >>> import requests
116115 >>> import cloudpickle
117116 >>> image_url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"
118-
119117 >>> image = PIL.Image.open(requests.get(image_url, stream=True).raw)
120- >>> image_bytes = cloudpickle.dumps(image)
121118
122119 >>> # Generate prediction by invoking the deployed endpoint
123120 >>> preds = huggingface_pipeline_model.predict(image)["prediction"]
@@ -171,10 +168,10 @@ Model deployment endpoints can be invoked with the oci sdk. This example invokes
171168 >>> headers = {"Content-Type": "application/octet-stream"}
172169 >>> endpoint = huggingface_pipeline_model.model_deployment.url + "/predict"
173170
174- ## download the image
175- image_url = "https://huggingface.co/datasets/Narsil/image_dummy/raw/main/parrots.png"
176- image = PIL.Image.open(requests.get(image_link, stream=True).raw)
177- image_bytes = cloudpickle.dumps(image)
171+ >>> ## download the image
172+ >>> image_url = "https://huggingface.co/datasets/Narsil/image_dummy/raw/main/parrots.png"
173+ >>> image = PIL.Image.open(requests.get(image_link, stream=True).raw)
174+ >>> image_bytes = cloudpickle.dumps(image)
178175
179176 >>> preds = requests.post(endpoint, data=image_bytes, auth=default_signer()['signer'], headers=headers).json()
180177 >>> print([{"score": round(pred["score"], 4), "label": pred["label"]} for pred in preds['prediction']])
@@ -200,7 +197,6 @@ Example
200197 ## download the image
201198 image_url = "https://huggingface.co/datasets/Narsil/image_dummy/raw/main/parrots.png"
202199 image = PIL.Image.open(requests.get(image_link, stream=True).raw)
203- image_bytes = cloudpickle.dumps(image)
204200
205201 ## download the pretrained model
206202 classifier = pipeline(model="openai/clip-vit-large-patch14")
0 commit comments