@@ -103,7 +103,6 @@ Deploy and Generate Endpoint
103
103
... deployment_predict_log_id="ocid1.log.oc1.xxx.xxxxx",
104
104
... )
105
105
>>> print(f"Endpoint: {huggingface_pipeline_model.model_deployment.url}")
106
- https://modeldeployment.{region}.oci.customer-oci.com/ocid1.datasciencemodeldeployment.oc1.xxx.xxxxx
107
106
108
107
Run Prediction against Endpoint
109
108
===============================
@@ -115,9 +114,7 @@ Run Prediction against Endpoint
115
114
>>> import requests
116
115
>>> import cloudpickle
117
116
>>> image_url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"
118
-
119
117
>>> image = PIL.Image.open(requests.get(image_url, stream=True).raw)
120
- >>> image_bytes = cloudpickle.dumps(image)
121
118
122
119
>>> # Generate prediction by invoking the deployed endpoint
123
120
>>> preds = huggingface_pipeline_model.predict(image)["prediction"]
@@ -171,10 +168,10 @@ Model deployment endpoints can be invoked with the oci sdk. This example invokes
171
168
>>> headers = {"Content-Type": "application/octet-stream"}
172
169
>>> endpoint = huggingface_pipeline_model.model_deployment.url + "/predict"
173
170
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)
178
175
179
176
>>> preds = requests.post(endpoint, data=image_bytes, auth=default_signer()['signer'], headers=headers).json()
180
177
>>> print([{"score": round(pred["score"], 4), "label": pred["label"]} for pred in preds['prediction']])
@@ -200,7 +197,6 @@ Example
200
197
## download the image
201
198
image_url = "https://huggingface.co/datasets/Narsil/image_dummy/raw/main/parrots.png"
202
199
image = PIL.Image.open(requests.get(image_link, stream=True).raw)
203
- image_bytes = cloudpickle.dumps(image)
204
200
205
201
## download the pretrained model
206
202
classifier = pipeline(model="openai/clip-vit-large-patch14")
0 commit comments