Skip to content

How to Use Separate Components

dilyararimovna edited this page Feb 7, 2023 · 1 revision

How to Use Separate Components

If you want to utilize some components separately, you may lift docker containers with the components of interest. If the components are utilized in main distribution, you may utilize proxy containers -- on our servers we lift components of the main distribution to be available for all users.

So, if you want to use a component available as a proxy container, you may lift this container container-name using the following command:

docker-compose -f docker-compose.yml -f assistant_dists/dream/docker-compose.override.yml -f assistant_dists/dream/dev.yml -f assistant_dists/dream/proxy.yml up --build container-name

If you want to lift the container locally (on your machine), use the following command:

docker-compose -f docker-compose.yml -f assistant_dists/dream/docker-compose.override.yml -f assistant_dists/dream/dev.yml up --build container-name

After that you may find the folder (find in assistant_dists/dream/docker-compose.override.yml) and python test file for this component as a reference how to address it.

Example

Let us show how to utilize Entity Detection component. I look into assistant_dists/dream/pipeline_conf.json file to find entity_detection component in a pipeline and the corresponding container name entity-detection.

So, I lift the container entity-detection using proxy:

docker-compose -f docker-compose.yml -f assistant_dists/dream/docker-compose.override.yml -f assistant_dists/dream/dev.yml -f assistant_dists/dream/proxy.yml up --build entity-detection

Then I look into assistant_dists/dream/docker-compose.override.yml and find the corresponding folder annotators/entity_detection/. I look into the folder and find a python test file annotators/entity_detection/test_entity_detection.py. The way to send requests to entity-detection is following:

import requests


requests.post("http://0.0.0.0:8103/respond", json={"sentences": [["what is the capital of russia?"]]})

The port 8103 is available outside the container because of the port's mapping in assistant_dists/dream/dev.yml.