Deploy
With Picsellia π₯ serverless deployment you can deploy your exported models easily.
Pre-requisite
In order to benefit from our serverless deployment engine, you need to have some exported models in your model registry.
Select the model that you want to deploy
To select the model, browse into your model registry page
.
Let's select version 0.0
of our sample-model
model π₯.
You can quickly see the overview of your exported model i.e the training set used and the experiment that created this model.
Deploy
You have 3 different options:
- Deploy Serverless.
- Use your Custom Serving.
- Only use your deployment dashboard to Monitor your models.
Access your deployment dashboard
Your deployment is now created and you can access its name on top-left.
You now have access to your deployment dashboard, this is the one-stop place to:
- Model Management.
- Latency Monitoring.
- Prediction images visualization and review.
- Alerting, etc.
If you want more information about all the monitoring metrics provided in the Picsellia monitoring, please check the Model Monitoring Section of Picsellia's documentation π₯.
Try prediction
import requests
import json
from picsellia import Client
client = Client(
api_token="YOUR API TOKEN", # Can be retrieved from your profile on the platform.
organization_name="YOUR ORGANIZATION NAME" # Default to your organization.
)
# Get deployment by its ID.
my_deployment = client.get_deployment_by_id(id="deployment-id")
# Get deployment by name.
#my_deployment = client.get_deployment(name="deployment-name")
# Get your deployment ID.
deployment_id = str(my_deployment.id)
# Get your API token from your profile.
api_token = "YOUR API TOKEN"
# Authentication url
auth_url = "https://serving.picsellia.com/api/login"
headers = {
"Authorization": "Token " + api_token,
}
jwt_generation_data = {
"deployment_id": deployment_id,
"api_token": api_token
}
jwt_request = requests.post(
auth_url,
headers=headers,
data=json.dumps(jwt_generation_data)
)
# Retrieving the JWT.
jwt = jwt_request.json()["jwt"]
# Serving API endpoint
url = "https://serving.picsellia.com/api/deployment/{}/predict".format(my_deployment.id)
header = {
"Authorization": "Bearer " + jwt,
}
# Metadata that helps extrat data from datalake.
data = {
"source": "camera1",
"tag": "tag"
}
imgpath = "path/to/image"
with open(imgpath, "rb") as file:
r = requests.post(
url=url,
files={'media': file},
headers=header,
data=data
)
print(r.text)
prediction = r.json()
Now you have a scalable and serverless API endpoint that won't change even if you change your model version :).
Updated 3 months ago