🚀 TabPFN is now available on Azure AI Foundry! See our guide to get started.
import os, json, requests
# Define your test dataset path
test_path = "test.csv"
# Get your API key from the environment
api_key = os.getenv("PRIORLABS_API_KEY")
headers = {"Authorization": f"Bearer {api_key}"}
# Create prediction payload
payload = {
"task": "classification",
"model_id": model_id, # Use model_id from your /v1/fit call
}
files = {
"data": (None, json.dumps(payload), "application/json"),
"file": (test_path, open(test_path, "rb")),
}
predict_response = requests.post(
"https://api.priorlabs.ai/v1/predict",
headers=headers,
files=files,
)
print("✅ Predictions:")
print(json.dumps(predict_response.json(), indent=2)){
"duration_seconds": 15,
"prediction": [
[
0.1,
0.9
],
[
0.8,
0.2
]
],
"task": "classification",
"params": {
"average_before_softmax": false,
"categorical_features_indices": null,
"device": [
"cpu"
],
"differentiable_input": false,
"fit_mode": "fit_preprocessors",
"ignore_pretraining_limits": true,
"inference_config": null,
"inference_precision": "auto",
"memory_saving_mode": true,
"model_path": "auto",
"n_estimators": 8,
"n_jobs": null,
"n_preprocessing_jobs": 4,
"random_state": 42,
"softmax_temperature": 0.2
},
"used_credits": 10,
"remaining_quota": 90
}Run inference using a previously fitted TabPFN model. Upload your test dataset and specify the model ID from your previous /v1/fit call. The endpoint returns predicted probabilities or values depending on the task type.
import os, json, requests
# Define your test dataset path
test_path = "test.csv"
# Get your API key from the environment
api_key = os.getenv("PRIORLABS_API_KEY")
headers = {"Authorization": f"Bearer {api_key}"}
# Create prediction payload
payload = {
"task": "classification",
"model_id": model_id, # Use model_id from your /v1/fit call
}
files = {
"data": (None, json.dumps(payload), "application/json"),
"file": (test_path, open(test_path, "rb")),
}
predict_response = requests.post(
"https://api.priorlabs.ai/v1/predict",
headers=headers,
files=files,
)
print("✅ Predictions:")
print(json.dumps(predict_response.json(), indent=2)){
"duration_seconds": 15,
"prediction": [
[
0.1,
0.9
],
[
0.8,
0.2
]
],
"task": "classification",
"params": {
"average_before_softmax": false,
"categorical_features_indices": null,
"device": [
"cpu"
],
"differentiable_input": false,
"fit_mode": "fit_preprocessors",
"ignore_pretraining_limits": true,
"inference_config": null,
"inference_precision": "auto",
"memory_saving_mode": true,
"model_path": "auto",
"n_estimators": 8,
"n_jobs": null,
"n_preprocessing_jobs": 4,
"random_state": 42,
"softmax_temperature": 0.2
},
"used_credits": 10,
"remaining_quota": 90
}Documentation Index
Fetch the complete documentation index at: https://docs.priorlabs.ai/llms.txt
Use this file to discover all available pages before exploring further.
Bearer token for authentication, obtained after signing up and generating an API key.
A JSON string defining the prediction request parameters.
Required fields:
model_id (str) - Model ID from your previous /v1/fit calltask (str) - Task type: "classification" or "regression"Optional Config Parameters:
systems (list[str]) - default: ["preprocessing", "text"].
The following preprocessing systems are supported:
["preprocessing"] - Applies skrub preprocessing,["text"] - Adds text embeddings for text columns.n_estimators (int) - Number of estimators in the ensemble (1-10)model_path (str) - Model checkpoint path from HuggingFacecategorical_features_indices (List[int]) - Indices of categorical featuressoftmax_temperature (float) - Temperature for softmax scalingaverage_before_softmax (bool) - Average before applying softmaxignore_pretraining_limits (bool) - Ignore pretraining limitsinference_precision (str) - Inference precision ("float32", "float16", "auto")random_state (int) - Random seed for reproducibilitybalance_probabilities (bool) - Balance class probabilitiesOptional Params (output configuration):
output_type (str) - Determines prediction output format
"probas" (default, probabilities) or "preds" (predictions)"mean" (default, mean value) or "full" (includes quantiles, ei, pi)CSV file containing the dataset to predict on.
Prediction completed successfully — returns predicted values or probabilities depending on the task.
Time taken (in seconds) to complete the prediction.
The prediction output. Format depends on task and output_type:
[1250.5, 3200.8, 980.2])output_type: probas: List of lists (probabilities) (e.g., [[0.1, 0.9], [0.8, 0.2]])output_type: preds: List of classes (e.g., ["class_0", "class_1"])Specifies the type of task to perform — either classification or regression.
classification, regression The number of credits consumed by this API call.
Your remaining credit balance after this request.
The inference parameters that were used during prediction.
Show child attributes
Was this page helpful?