Skip to main content

Run prediction functions locally in Python. Register at https://fxn.ai.

Project description

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. In a few steps:

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.9+

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

Let's run the @fxn/greeting predictor which accepts a name and returns a congenial greeting. Run the following Python script:

from fxn import Function

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

[!TIP] Explore public predictors on Function or create your own. r

Using the Function CLI

Open up a terminal and run the following command:

# Login to Function
fxn auth login <ACCESS KEY>

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

Useful Links

Function is a product of NatML Inc.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fxn-0.0.37.tar.gz (616.2 kB view hashes)

Uploaded Source

Built Distribution

fxn-0.0.37-py3-none-any.whl (621.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page