Skip to content

fxnai/fxn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

a61b19f · Feb 13, 2025
Aug 24, 2024
Feb 13, 2025
Jan 31, 2025
Aug 31, 2023
Mar 20, 2024
Feb 13, 2025
May 16, 2023
Oct 12, 2024
Jan 23, 2025
Jan 23, 2025
Jan 23, 2025
Aug 21, 2024

Repository files navigation

Function for Python and CLI

function logo

Dynamic JSON Badge

Run prediction functions (a.k.a "predictors") locally in your Python apps, with full GPU acceleration and zero dependencies.

Tip

Join our waitlist to bring your custom Python functions and run them on-device across Android, iOS, macOS, Linux, web, and Windows.

Installing Function

Function is distributed on PyPi. This distribution contains both the Python client and the command line interface (CLI). To install, open a terminal and run the following command:

# Install Function
$ pip install --upgrade fxn

Note

Function requires Python 3.10+

Retrieving your Access Key

Head over to fxn.ai to create an account by logging in. Once you do, generate an access key:

generate access key

Making a Prediction

First, create a Function client, specifying your access key:

from fxn import Function

# Create the Function client
fxn = Function(access_key="<Function access key>")

Then make a prediction:

# Create a prediction
prediction = fxn.predictions.create(
    tag="@fxn/greeting",
    inputs={ "name": "Peter" }
)
# Print the returned greeting
print(prediction.results[0])

Using the Function CLI

Open up a terminal and login to the Function CLI:

# Login to Function
$ fxn auth login <ACCESS KEY>

Then make a prediction:

# Make a prediction using the Function CLI
$ fxn predict @fxn/greeting --name Peter

Useful Links

Function is a product of NatML Inc.