Unbox
Search…
Getting Started

Signup

The first step is to navigate to our web app (or desktop app, if you've been delivered a build) and sign up for an account. Our web app is available at https://app.unbox.ai.

Upload

Once you've created an account, the next step is to upload your model(s) and dataset(s). We have a super simple and quick way to do this via our Python SDK.
If you need support for other languages than Python, please reach out!

Installation

1
$ pip install unboxapi
Copied!

Usage

1
import unboxapi
2
3
client = unboxapi.UnboxClient('YOUR_API_KEY_HERE')
Copied!
You can find your API key in the app. After you login, hover over your picture in the top-right corner, and navigate to "Account."
1
from unboxapi.models import ModelType
2
3
# Predict function
4
def predict(model, text_list, **kwargs):
5
# Set and use your kwargs however you need
6
return model.predict(text_list)
7
8
# (Optional) Tokenizer function that can be used
9
# by your predict function but will also be used for explainability
10
def tokenizer(text_list):
11
# Perform any tokenization
12
return tokens # eg. [["hello", "world"], ["one", "two"]]
13
14
# Package your model and upload it to Unbox
15
client.add_model(
16
function=predict,
17
model=model,
18
model_type=ModelType.sklearn,
19
class_names=['negative', 'positive'],
20
name='My First Model',
21
description='Sentiment analyzer for tweets',
22
# path/to/requirements file for dep's needed for inference
23
requirements_txt_file='./requirements.txt',
24
# path/to/script to install any extra dep's for inference
25
# e.g. spacy artifacts
26
setup_script='./setup.sh', # Optional
27
tokenizer=tokenizer, # Optional
28
**kwargs # Specify additional kwargs for your predict function
29
)
Copied!

Datasets

1
# Upload your dataset csv to Unbox
2
client.add_dataset(
3
file_path='path/to/dataset.csv',
4
class_names=['negative', 'positive'], # Notice it matches the model class names
5
label_column_name='polarity',
6
text_column_name='text',
7
name='My First Dataset',
8
description='My sentiment analysis validation dataset',
9
tag_column_name='tags', # Optional
10
sep=",", # Optional separator
11
)
12
13
# Alternatively, upload your pandas dataframe to Unbox
14
client.add_dataframe(
15
df=dataframe,
16
class_names=['negative', 'positive'], # Notice it matches the model class names
17
label_column_name='polarity',
18
text_column_name='text',
19
name='My Second Dataset',
20
description='My sentiment analysis validation pandas dataframe',
21
tag_column_name='tags', # Optional
22
)
Copied!
Congrats! 🥳 You're now ready to start using the platform.
Datasets that correspond with models (and vice-versa) need to have the same class_names. This means the lists need to be equal, including order.
Last modified 2mo ago