Tangram for Python

pip install tangram==0.7.0


Tangram + Python

The Tangram Python library makes it easy to make predictions with your Tangram machine learning model from Python.


$ pip install tangram
import tangram

model = tangram.Model.from_file('./heart-disease.tangram')

input = {
  'age': 63,
  'gender': 'male',
  # ...

output = model.predict(input)


For more information, read the docs.

Platform Support

tangram-python is currently supported for Linux, macOS, and Windows on x64-64/amd64/x64 CPUs. Are you interested in another platform? Get in touch via email at help@tangramhq.com or with the chat bubble on our website at https://www.tangramhq.com.


This repo contains two examples, examples/predict and examples/monitor.


This example demonstrates loading a model from a .tangram file and making a prediction.


This example demonstrates logging predictions and true values to the Tangram reporting and monitoring app. Before running the example, upload the heart-disease.tangram file in examples/monitor/heart-disease.tangram to either https://app.tangramhq.com or your private instance. Then generate a token by clicking the "Tokens" link on the right side of the top bar.

Then you can run the example:

$ TANGRAM_TOKEN=<YOUR TOKEN HERE> python3 examples/monitor/main.py

Now if you refresh the production stats or production metrics tabs for the model you uploaded, you should see predictions and true values being reported.

For more information on reporting and monitoring, read the docs.