Getting started with AI Apps
Discover AI Apps and deploy your first application
Discover AI Apps and deploy your first application
Last updated January 10th, 2022.
OVHcloud provides a set of managed AI tools designed for building your machine learning projects.
This guide explains how to get started with OVHcloud AI Apps by deploying your first application through the Control Panel.
Log in to your OVHcloud Control Panel and switch to Public Cloud
in the top navigation bar. After selecting your Public Cloud project, click on AI Apps
in the left-hand navigation bar under AI & Machine Learning.
Click on the Deploy an AI App
button and accept terms and conditions if any.
Once clicked, you will be redirected to the creation process detailed below.
Select where your AI App will be hosted, meaning the physical location.
OVHcloud provides multiple datacenters. You can find the capabilities for AI Apps in the guide AI Apps capabilities.
AI Apps allows a user to deploy applications from two sources:
In this tutorial, we will select English Sentiment Analysis from the HuggingFace company.
These AI models will work to detect the positive or negative feelings in English sentences.
If you want to deploy your own container, you need to comply with a few rules like adding a specific user. Follow our Build and use custom images guide.
An AI App needs compute resources to be deployed, from a minimum of one instance to a maximum of ten. Each instance will be billed based on the amount of running time, whether or not you use your AI App.
Each node is composed of:
You can modify the Resource Size to adjust the amount of CPU or GPU cores, RAM and Network Bandwidth. Then you can modify the Number of instances on which your AI Apps will be deployed.
To benefit from High Availability, a minimum of 2 instances are required.
For our first deployment, we will select two instances.
First, choose a name for your AI Apps or keep the automatically generated name.
Then, you have the option to add some Key/Value labels to filter or organize your AI App access.
As an example, add a label with Key=owner and Value=bastien.
The last parameter to select is the Access rule. Either you restrict your AI Apps access to selected tokens, or you allow any access. Use this option carefully; usually a Public access is used for a test, but not in production since everyone will be able to use it.
We will select Restricted Access for this deployment.
This final step is a summary about your AI App deployment. You can review the previously selected options and parameters.
Launch your AI App by clicking on Deploy an AI App
Congratulations, your first AI App is now running on production!
AI Apps can be your own Docker container or applications proposed by the OVHcloud ecosystem.
In this tutorial, we deployed a HuggingFace AI model allowing us to analyze positive or negative sentiment in English sentences. There is no web interface to manage this AI model. What is given is an API endpoint that you can reach via HTTP.
First, go check your AI App details and verify that your AI App has a running status. Please also verify that your labels are clearly mentioned.
In this example, we added the label owner=bastien and two labels were automatically added by OVHcloud.
During the AI Apps deployment process, we selected "restricted access". To query your AI App, you first need a valid security token.
In your OVHcloud Control Panel, go to your AI Apps list. Select the Token tab.
Click on the New token
button then fill in a name, a label selector, a role and region as below:
A few explanations:
Now that your AI App is running and token generated, you are ready for your first query.
You can find the cURL example in the bottom part of your AI App, with standard parameters and JSON output format.
Since we are on restricted access, you need to specify the authentication token in the header following this format:
-H "Authorization: Bearer $YOURTOKENHERE"
In our case, the exact cURL code is:
curl --request POST
--url https://982a750f-e1f0-45cf-bf41-efc1031f1101.app.bhs.training.ai.cloud.ovh.net/predict
-H "Authorization: Bearer 0sTWeKaATGuV0a0cqFZeNV2tILbdxgYLoMQRxvWABHYWWDQ4JDs945o4Afhy+6Sj"
--header 'Content-Type: application/json'
--data '{
"inputs": "I love curl so much!"
}'
```
Giving us
```bash
{
"probabilities": [0.003630106, 0.99636996],
"info": {
"was_input_truncated": false,
"num_tokens": 8
}
}
Probability result is explained in negative sentiment then positive sentiment. Here, we obtain a 99,6% positive score.
If you want to query this model with Python, this code sample with Python Request library may suit you:
import requests
import json
from requests.structures import CaseInsensitiveDict
url = "https://982a750f-e1f0-45cf-bf41-efc1031f1101.app.bhs.training.ai.cloud.ovh.net/predict"
headers = CaseInsensitiveDict()
headers["Authorization"] = "Bearer 0sTWeKaATGuV0a0cqFZeNV2tILbdxgYLoMQRxvWABHYWWDQ4JDs945o4Afhy+6Sj"
data = {'inputs': 'I love curl so much!'}
resp = requests.post(url, headers=headers, json=data)
print(resp.status_code)
print(resp.json())
Result:
200
{'probabilities': [0.003630106, 0.99636996], 'info': {'was_input_truncated': False, 'num_tokens': 8}}
That's it! To go further, you can imagine a script which gathers latest Facebook or Twitter messages and analyze their sentiment over time.
You can keep your AI App running as long as you want. At any time, you may stop your application in your AI App details:
Once stopped, your AI App will free up the previously allocated compute resources. Your endpoint is kept and if you restart your AI App, the same endpoint can be reused seamlessly. Also, when you stop your AI App, you don't book compute resources anymore which means you don't have expenses for this part. Only expenses for attached storage may occur.
If you want to completely delete your AI App, just click on the delete
action.
Be sure to also delete your Object Storage data if you don't need it anymore.
Please feel free to send us your questions, feedback and suggestions to help our team improve the service on the OVHcloud Discord server!
Please feel free to give any suggestions in order to improve this documentation.
Whether your feedback is about images, content, or structure, please share it, so that we can improve it together.
Your support requests will not be processed via this form. To do this, please use the "Create a ticket" form.
Thank you. Your feedback has been received.
Access your community space. Ask questions, search for information, post content, and interact with other OVHcloud Community members.
Discuss with the OVHcloud community