Skip to main content

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

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for jamspy-0.1.2.tar.gz
Algorithm Hash digest
SHA256 ebc701dc6b79ba45a6e46226ced5fbba864e9ba0802b0be832b641fd8e6d3b4c
MD5 74a8e88f108f23e9a04719826b4df92e
BLAKE2b-256 558d6852458ef67a46df11cc81d264ef9a74ef3152e5fdaee9fc1c7c97ef8e2c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jamspy-0.1.2-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.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 eb7017502c435e2a51b8f09b57f8cf1c90f81f1661446219f2e8ad49c64bde50
MD5 a106d691f4cef398d38532663688c3df
BLAKE2b-256 d028a7f893718e9c186baf62c123e41d551538b9e1fbb1d6f0bd531e1bae8a6b

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