Run prediction functions locally in Python. Register at https://fxn.ai.
Project description
Function for Python and CLI
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:
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
- Discover predictors to use in your apps.
- Join our Discord community.
- Check out our docs.
- Learn more about us on our blog.
- Reach out to us at hi@fxn.ai.
Function is a product of NatML Inc.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.