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.0.1.tar.gz
(12.1 kB
view details)
File details
Details for the file jamspy-0.0.1.tar.gz.
File metadata
- Download URL: jamspy-0.0.1.tar.gz
- Upload date:
- Size: 12.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bae6a2dbab04b4957e775a2c929d01883826fefed4cac88ba87c84ab5066ba36
|
|
| MD5 |
79d14fee63cd673bb509fbddd04c63d9
|
|
| BLAKE2b-256 |
9392e34972831f939c131e5d1643485ce81910e44187842793533e6e6be819cd
|