ModelZoo
Python package to query ModelZoo.Live
API
For more specific API details, please check out the docs within the files.
Examples
Initialization
# Connects to a ModelZoo instance running at http://modelzoo.url/
conn = ModelZooConnection(address="http://modelzoo.url/")
# Authenticate to service. Neccessary to see your token.
conn.authenticate("myemail@me.com", "mypassword")
Get Models
# Assuming conn initialized previously
conn.list_all_models()
Get Token
# Assuming conn initialized previously, and authenticated to server
conn.get_token()
Create User
# Assuming conn initialized previously
conn.create_user("mynewemail@me.com", "mynewpassword")
Text Inference
# Assuming conn initialized previously
model_name = "MyModelName"
input = ["Input1", "Input2"]
p = conn.text_inference(model_name, input)
# type(p) = modelzoo.protos.Payload
If your model's output is text, you could expect an output formatted like so:
p = Payload({type: PayloadType.TEXT, text = t})
t = Text({metadata: {...}, texts: ["output1", ...], model_name: "name", access_token: "token"})
Image Inference
# Assuming img is your image input.
# img can be oneof(filename, PIL.Image, image data uri)
model_name = "MyModelName"
p = conn.image_inference(model_name, img)
# type(p) = modelzoo.protos.Payload
If your model's output is an image, you could expect an output formatted like so:
p = Payload({type: PayloadType.IMAGE, image = t})
t = Image({metadata: {...}, image_data_url: "img_output_uri", model_name: "name",
access_token: "token"})
It is important to note that your model is not constrained to return an output of the same type as its input.
It is perfectly valid, for example, for a model to take a text input, and return an image output, or vice versa.
Extracting Output for Inference
...
# p is the Payload object returned by
# oneof(text_inference, image_inference)
if p.type == PayloadType.TEXT:
out = sugar.text_input(p.text)
elif p.type == PayloadType.IMAGE:
out = sugar.image_input(p.image)
# out = oneof(List[string], PIL.Image)
Post Processing for Inference
...
# p is the Payload object returned by
# oneof(text_inference, image_inference)
def callback(input):
# Input is oneof(pd.DataFrame, List[string], PIL.Image)
return output
o = conn.process_inference_response(p, callback)
# o == callback(extract(payload))
Metadata
Release files for modelzoo 0.3.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| modelzoo-0.3.3-py3-none-any.whl | Python 3 | none | any | Details for modelzoo-0.3.3-py3-none-any.whl |
Release files / modelzoo-0.3.3-py3-none-any.whl
| Download URL | modelzoo-0.3.3-py3-none-any.whl |
|---|---|
| Size | 21.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4199094411618530e001d0ce6782e3d1fd51c86908df0faa01be36463f295c64
|
|
BLAKE2b-256 checksum How to use checksums |
28540a8f90e7079aff8ea3349be7ca5ba449a434f8404079941375d2c56392db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8
|
Security for modelzoo 0.3.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.