Make AI predictions in the command line interface.
You can make predictions right in the command line.
Installing Function CLI
To install Function CLI, open a terminal and run the following command:
# Open a terminal and run the following command:pip install --upgrade fxn
Logging in to Function
Next, head over to your Account ↗ page to generate an access key:
Now, you can login to Function CLI with your access key:
# Open a terminal and run the following commandfxn auth login <ACCESS KEY>
Here is an example showing a successful login in the CLI:
We'll need a predictor to make predictions with. You can either use a public predictor on Function, or make your own →. In this guide, we'll be using the
You can discover and use public predictors on Function.
We'll be using the greeting predictor in this guide.
The predictor accepts a
name of the person to greet, optionally with their
city. Let's make the prediction:
# Predictfxn predict @samplefxn/greeting --name Rhea --age 44 --city "Los Angeles"
Using File Inputs
For predictors that accept binary data (e.g. image, audio, video, binary files), pass in the file path prefixed with the
Here's an example that makes a prediction on an image file
cat.jpg using a generic
# Make a prediction using a file inputfxn predict @username/classifier --image @cat.jpg
@character for working with files is similar to