Skip to main content

A HTTP & gRPC client for J.A.M.S - Just Another Model Server in Python

Reason this release was yanked:

path issues

Project description

J.A.M.S Python Client

A HTTP & gRPC client for J.A.M.S - Just Another Model Server

Installation

pip install jamspy

Usage

Start J.A.M.S by following the instructions here

HTTP

from jamspy.client.http import Client

# init client
client = Client('0.0.0.0:3000')

# healthcheck
client.health_check()

# predict   
model_name = "titanic_model"
model_input = json.dumps(
    {
        "pclass": ["1", "3"],
        "sex": ["male", "female"],
        "age": [22.0, 23.79929292929293],
        "sibsp": [
            "0",
            "1",
        ],
        "parch": ["0", "0"],
        "fare": [151.55, 14.4542],
        "embarked": ["S", "C"],
        "class": ["First", "Third"],
        "who": ["man", "woman"],
        "adult_male": ["True", "False"],
        "deck": ["Unknown", "Unknown"],
        "embark_town": ["Southampton", "Cherbourg"],
        "alone": ["True", "False"],
    }
)
prediction = client..predict(model_name=model_name, model_input=model_input)
prediction.values # use predictions


# add model
client.add_model(model_name='tensorflow-my_awesome_penguin_model') # <MODEL FRAMEWORK>-<MODEL_NAME>

# update model
client.update_model(model_name='my_awesome_penguin_model')

# delete model
client.delete_model(model_name='my_awesome_penguin_model')

# get models
models = client.get_models()
print(models)

gRPC

from jamspy.client.grpc import Client

# init client
client = Client('0.0.0.0:4000')

# healthcheck
client.health_check()

# predict   
model_name = "titanic_model"
model_input = json.dumps(
    {
        "pclass": ["1", "3"],
        "sex": ["male", "female"],
        "age": [22.0, 23.79929292929293],
        "sibsp": [
            "0",
            "1",
        ],
        "parch": ["0", "0"],
        "fare": [151.55, 14.4542],
        "embarked": ["S", "C"],
        "class": ["First", "Third"],
        "who": ["man", "woman"],
        "adult_male": ["True", "False"],
        "deck": ["Unknown", "Unknown"],
        "embark_town": ["Southampton", "Cherbourg"],
        "alone": ["True", "False"],
    }
)
prediction = client..predict(model_name=model_name, model_input=model_input)
prediction.values # use predictions


# add model
client.add_model(model_name='tensorflow-my_awesome_penguin_model') # <MODEL FRAMEWORK>-<MODEL_NAME>

# update model
client.update_model(model_name='my_awesome_penguin_model')

# delete model
client.delete_model(model_name='my_awesome_penguin_model')

# get models
models = client.get_models()
print(models)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jamspy-0.3.0.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jamspy-0.3.0-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file jamspy-0.3.0.tar.gz.

File metadata

  • Download URL: jamspy-0.3.0.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for jamspy-0.3.0.tar.gz
Algorithm Hash digest
SHA256 66d83eee39cf439497a3c93cfd8ba853b8538ee2014dfd2eb733278783b07dfc
MD5 31a05b26eecd40bdf6976a752e7f7ab7
BLAKE2b-256 c9e2e45718e1ed5848e2abd8c6d2fdc5d3d712bf2c51414059d084870a6e9c45

See more details on using hashes here.

File details

Details for the file jamspy-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: jamspy-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for jamspy-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5389c6d0a3bd1f6c57f48a2422cb36b5a302b50e7067f8e77ef290867b2ad162
MD5 514f875142ed72d61c9218bd46a89a27
BLAKE2b-256 442e5b2680ecec459ed342ea20b72fa1496cf6e926a4a8f25d39e6706a815462

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page