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
Release history Release notifications | RSS feed
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.0.tar.gz
(13.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
jamspy-0.1.0-py3-none-any.whl
(15.8 kB
view details)
File details
Details for the file jamspy-0.1.0.tar.gz.
File metadata
- Download URL: jamspy-0.1.0.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0e12248439c5b3e69d1ee48680487f1940b374552d48357b8c2c34b909d23af
|
|
| MD5 |
a5dfb588380122d18ef7cb401d69f8a4
|
|
| BLAKE2b-256 |
7ae2bcd04b48642b10663e2094197b771c030bbb85293ca63c6c94fcff75eef8
|
File details
Details for the file jamspy-0.1.0-py3-none-any.whl.
File metadata
- Download URL: jamspy-0.1.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc3d28cdfb6231096e1a3af34c1bc98bd18128ba8a047fe72be74f82eec7de32
|
|
| MD5 |
50ddfc61a522390e78f5c0c920d278bd
|
|
| BLAKE2b-256 |
220f22eb9f9e5cd27e1bae1e35b2ab575e7ce158b627fc85d006f92424622480
|