HumanSignal / HumanSignal/label-studio-ml-backend

problems running ml backend with data from localhost

Open
#155 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.1k
Forks
490
Avg merge
1d 14h
Merged PRs (30d)
3

Description

Hi there. I am new to label-studio-ml, just started using the tool today. I am trying to run the example [mmdetection](https://github.com/heartexlabs/label-studio-ml-backend/tree/d6e72f9e9b48129173df16a8ee5dc4a148f30f5c/label_studio_ml/examples/mmdetection), and have run into a problem trying to run the model on the backend of label-studio running through my localhost. I have uploaded an image manually to labelstudio, and added the model from http://localhost:9091. When I go to run the automated labelling, I get the following traceback from label-studio:

```bash
[24/Aug/2022 22:53:50] "GET /data/upload/2/6c449796-0032078421520747-1657602370819-20220712-360-n1yNFk_left.jpg HTTP/1.1" 200 2083378
[2022-08-24 22:53:51,751] [ml.models::predict_tasks::171] [WARNING] Prediction not created for project (id=1, url=http://localhost:9091): 500 Server Error: INTERNAL SERVER ERROR for url: http://localhost:9091/predict
```

To confirm that it was the request that was having problems, I ran the following from inside the server docker container:

```python
requests.get('http://localhost:8083/data/upload/1/d2f932ea-0032078421520747-1657602370819-20220712-360-E-IfNo_right.jpg')
```

Traceback:
```bash
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 73, in get
return request("get", url, params=params, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 565, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8083): Max retries exceeded with url: /data/upload/1/d2f932ea-0032078421520747-1657602370819-20220712-360-E-IfNo_right.jpg (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused'))
```

And also ran the following (I landed on 172.17.0.1 from [this link](https://forums.docker.com/t/how-to-reach-localhost-on-host-from-docker-container/113321/2)):

```python
requests.get('http://172.17.0.1:8083/data/upload/1/d2f932ea-0032078421520747-1657602370819-20220712-360-E-IfNo_right.jpg')
```
which returned the following request:
```bash
b'{"id":"99370e89-a4b3-456e-87ff-d278c9b6021d","status_code":401,"version":"1.5.0post0","detail":"Authentication credentials were not provided.","exc_info":null}'
```

In order to solve this issue, I have added the following to the docker-compose.yml:

```yml
extra_hosts:
- "localhost:172.17.0.1"
```

I'm not sure if this is the best solution, but it solved the problem for me

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.