Skip to main content

Importing Data and Models with private_import

private_import is a powerful feature provided by the AG server that enables users to load their own models or datasets directly into the server for use in their computations.

Importing a DataFrame

To import a DataFrame into the AG server, use the private_import function. Here's an example of how to import a DataFrame named 'df':

# Assuming you have a Pandas DataFrame named 'dataframe'
session.private_import(name='df', data=dataframe)

When executed, the DataFrame will be cached to the server and loaded into the kernel with the following confirmation:

dataframe cached to server, loading to kernel...
Output: Dataframe loaded successfully to the kernel

Note: The session object in AG is created as a result of logging into the antigranular (AG) environment.

Importing an ONNX Model

You can also import ONNX models using the private_import function. Here's how:

# To import an ONNX model from a variable
private_import(name='model', data=onnx_model)

# To import an ONNX model from a local path
private_import(name='model', path='local/path_to_model')
model cached to server, loading to kernel...
Output: Model loaded successfully to the kernel

The name parameter serves as an identifier for your imported data or model.