seblful / label-studio-yolov8-backend

ML backend for the Label Studio tool. The backend uses the YOLOv8 model for instance image segmentation or object detection.
52 stars 15 forks source link

requests.exceptions.ConnectionError: HTTPConnectionPoo #2

Closed abujbr closed 7 months ago

abujbr commented 11 months ago

I got this error in docker when try to predict images in label studio!

2023-10-17 14:38:33 2023-10-17 14:38:33 During handling of the above exception, another exception occurred: 2023-10-17 14:38:33 2023-10-17 14:38:33 Traceback (most recent call last): 2023-10-17 14:38:33 File "/usr/local/lib/python3.10/site-packages/label_studio_ml/exceptions.py", line 39, in exception_f 2023-10-17 14:38:33 return f(*args, kwargs) 2023-10-17 14:38:33 File "/usr/local/lib/python3.10/site-packages/label_studio_ml/api.py", line 51, in _predict 2023-10-17 14:38:33 predictions, model = _manager.predict(tasks, project, label_config, force_reload, try_fetch, params) 2023-10-17 14:38:33 File "/usr/local/lib/python3.10/site-packages/label_studio_ml/model.py", line 617, in predict 2023-10-17 14:38:33 predictions = cls._current_model.model.predict(tasks, kwargs) 2023-10-17 14:38:33 File "/app/./model.py", line 47, in predict 2023-10-17 14:38:33 image = Image.open(BytesIO(requests.get( 2023-10-17 14:38:33 File "/usr/local/lib/python3.10/site-packages/requests/api.py", line 73, in get 2023-10-17 14:38:33 return request("get", url, params=params, kwargs) 2023-10-17 14:38:33 File "/usr/local/lib/python3.10/site-packages/requests/api.py", line 59, in request 2023-10-17 14:38:33 return session.request(method=method, url=url, kwargs) 2023-10-17 14:38:33 File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 587, in request 2023-10-17 14:38:33 resp = self.send(prep, send_kwargs) 2023-10-17 14:38:33 File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 701, in send 2023-10-17 14:38:33 r = adapter.send(request, **kwargs) 2023-10-17 14:38:33 File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 565, in send 2023-10-17 14:38:33 raise ConnectionError(e, request=request) 2023-10-17 14:38:33 requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /data/upload/6/943e8493-1_2.png (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7ff1b24cbc70>: Failed to establish a new connection: [Errno 111] Connection refused')) 2023-10-17 14:38:33 2023-10-17 14:38:33 [pid: 25|app: 0|req: 18/18] 172.28.0.1 () {36 vars in 755 bytes} [Tue Oct 17 12:38:33 2023] POST /predict => generated 5061 bytes in 2 msecs (HTTP/1.1 500) 2 headers in 92 bytes (1 switches on core 0)

seblful commented 8 months ago

Probably, your locallhost is different, try to specify LS_URL in model.py. Beside it, you should check URL of machine learning backend in Label Studio.

Also, check your LS_API_TOKEN. It should match API in your Label Studio settings.