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.2.0.tar.gz (13.3 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.2.0-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for jamspy-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a914349495725d0a142b78b7f7417f15a1118efb9d54ce25f73d0e31cf969725
MD5 c0ffdfc11b98410187c91c7e8a87c9b7
BLAKE2b-256 1e557ed3cee6c98ead754d458254f01b90de09c4c7a69844801e33c91a4448f4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jamspy-0.2.0-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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a97aed354b3ca043ce85b38ac902017d6203f94456eb82230a580d07907751bd
MD5 a0d7100308773889ed9063e7c9809d58
BLAKE2b-256 576d24d3550e20459d9c838d658b3a6e15d42c7c0dabc9d2e94efc3f91de2ec7

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