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
await 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.1.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.1-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jamspy-0.3.1.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.1.tar.gz
Algorithm Hash digest
SHA256 9c89be8851fcf98b87ad199a32d6a12a68d8d074fd5fd9ebf390e5c5405b5195
MD5 d1f8303978b64433b43bf56a9e1de811
BLAKE2b-256 230c168a8674b8b53a68d4771bcfcc3db0712bc0f40fdb29af759fb592878898

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jamspy-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 15.8 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e8e3e0e0be45e928737fbec01e620d2211719311107feb790a700350b4ab5e55
MD5 dfcafd1c9675e8185060f9cbf28f0c78
BLAKE2b-256 5f2d393aaeb0383de93156594d93ab610eb3a6477e39ea5e008e11abb57b69fc

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