Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
73 lines (58 sloc) 5.76 KB


Each DeepPavlov model can be easily made available for inference as a REST web service. The general method is:

python -m deeppavlov riseapi <config_path> [-d] [-p <port>]
  • -d: downloads model specific data before starting the service.
  • -p <port>: sets the port to <port>. Overrides default settings from deeppavlov/utils/settings/server_config.json.

The command will print the used host and port. Default web service properties (host, port, model endpoint, GET request arguments) can be modified via changing deeppavlov/utils/settings/server_config.json file.

To interact with the REST API via graphical interface open <host>:<port>/apidocs in a browser (Flasgger UI).

Advanced configuration

By modifying deeppavlov/utils/settings/server_config.json you can change host, port, model endpoint, GET request arguments and other properties of the API service.

Properties from common_defaults section are used by default unless they are overridden by model-specific properties, provided in model_defaults section of the server_config.json. Model-specific properties are bound to the model by server_utils label in metadata/labels section of the model config. Value of server_utils label from model config should match with properties key from model_defaults section of server_config.json.

For example, metadata/labels/server_utils tag from go_bot/gobot_dstc2.json references to the GoalOrientedBot section of server_config.json. Therefore, model_endpoint parameter in common_defaults will be will be overridden with the same parameter from model_defaults/GoalOrientedBot.

Model argument names are provided as list in model_args_names parameter, where arguments order corresponds to model API. When inferencing model via REST api, JSON payload keys should match model arguments names from model_args_names. Default argument name for one argument models is "context". Here are POST requests examples for some of the library models:

Model POST request JSON payload example
One argument models
NER model {"context":["Elon Musk launched his cherry Tesla roadster to the Mars orbit"]}
Intent classification model {"context":["I would like to go to a restaurant with Asian cuisine this evening"]}
Automatic spelling correction model {"context":["errror"]}
Ranking model {"context":["What is the average cost of life insurance services?"]}
Goal-oriented bot {"context":["Hello, can you help me to find and book a restaurant this evening?"]}
Multiple arguments models
Question Answering model
{"context":["After 1765, growing philosophical and political differences strained the relationship between Great Britain and its colonies."],
 "question":["What strained the relationship between Great Britain and its colonies?"]}
You can’t perform that action at this time.