Documentation of the Modelhub REST API and Python API
The REST API is the main interface to a model packaged with the Modelhub framework. The REST API of a running model can be reached under http://<ip of model>:<port>/api/<call>. For example http://localhost:80/api/get_config
to retrieve a JSON string with the model configuration.
The REST API is automatically instantiated when you start a model via python start.py <your model name>
. See the following documentation of the ~modelhubapi.restapi.ModelHubRESTAPI
class for a documentation of all available functions.
modelhubapi.restapi
The Python API is a convenience interface to a model when you have direct access to the modelhub runtime environment, i.e. when you are inside the Docker running the model. This is, for example, the case if you work with the sandbox Jupyter notebook provided with the model you are running.
When you are working inside the Docker running a model, you can import the Modelhub Python API via from modelapi import model
. This is a convenience import, which implicitly takes care of initializing the ~modelhubapi.pythonapi.ModelHubAPI
with the model in the current Docker. You would then call the API (e.g. to get the model config) like this configuration = model.get_config()
.
modelhubapi.pythonapi