Get Started
The goal of this use case is to accompany you in understanding the mechanics of the platform with a simple and basic machine learning application.
The final goal of this get started will be to be able to generate predictions on the Craft AI platform. The model used to generate predictions will be the iris one, but you can use any Python code.
To achieve this goal, we will go through several parts:
Part 0 : Setup
This page is about the setup of the platform in your Python code and in the Craft AI platform UI.
There are 2 ways to access the platform:
- With the Python SDK, in line of code
- With the web interface, in a browser
Prerequisites
- Python 3.8 or higher is required to be installed on your computer.
- We strongly recommend the use of Google Chrome browser to use the UI of the platform.
We already have:
- A project
- An environment setup in the project with datastore and workers
Set up the Python SDK
The Python SDK can be installed with pip from a terminal. And, for this use case, you also need NumPy.
Initialization of Python SDK
Copy and paste the following commands into a Python terminal or script to initialize the SDK:
from craft_ai_sdk import CraftAiSdk
sdk = CraftAiSdk(
environment_url="MY_ENVIRONMENT_URL",
sdk_token="MY_ACCESS_TOKEN"
)
Set the value of environment_url
to your environment URL instead of MY_ENVIRONMENT_URL
. You can find this URL on the Environments page in the UI. The Environment URL is NOT the address of the page in your browser.
Set the value of sdk_token
to your access token instead of MY_ACCESS_TOKEN
. On the UI, click on your name in the top right corner, then go to the “Parameters” page. There, you can generate and find your SDK token at the bottom. The SDK token is strictly personal. You must keep it confidential.
Finally, run your code.
[Recommended] Setup your credential with a .env
file
A good practice would be to create a script that contains the setup of these 2 local environment variables. For example, you could create an .env
file.
-
Create a .env file.
-
Install dotenv lib in Python using pip
-
Execute the following Python code to set up SDK Python object.
Success
🎉 Well done! You’re ready to execute your first code on the platform!
What's next ?
Now that we have configured the platform, we can create our first objects and run a “Hello World” on the platform.
Next step: Part 1: Deploy a simple pipeline