How to configure minio in Label Studio

412 Views Asked by At

Successfully uploaded images using minio, but cannot be displayed on the page

docker-compose.yml
app:
  stdin_open: true
  tty: true
  build: .
  image: heartexlabs/label-studio:latest
  restart: unless-stopped
  expose:
    - "8000"
  depends_on:
    - db
  environment:
    - DJANGO_DB=default
    - POSTGRE_NAME=postgres
    - POSTGRE_USER=postgres
    - POSTGRE_PASSWORD=
    - POSTGRE_PORT=5432
    - POSTGRE_HOST=db
    - LABEL_STUDIO_HOST=${LABEL_STUDIO_HOST:-}
    - JSON_LOG=1
    - MINIO_STORAGE_ACCESS_KEY=minio_admin_do_not_use_in_production
    - MINIO_STORAGE_SECRET_KEY=minio_admin_do_not_use_in_production
    - MINIO_STORAGE_BUCKET_NAME=data
    - MINIO_STORAGE_ENDPOINT=http://minio:9000

enter image description here enter image description here

Successfully displayed on the page

1

There are 1 best solutions below

0
On

Your issue might be related to how Label Studio resolves paths. From the [Label Studio documentation][1], there's a specific setting for the host:

| `--host` | `LABEL_STUDIO_HOST` | `''` | Specify the hostname to use to generate links for imported labeling tasks or static loading requirements. Leave empty to make all paths relative to the root domain. For example, specify `"https://77.42.77.42:1234"` or `"http://ls.example.com/subdomain/"`. See [Run Label Studio with an external domain name](start.html#Run-Label-Studio-with-an-external-domain-name) on this page. |

If the LABEL_STUDIO_HOST is not set (or set to an empty string), Label Studio will use relative paths. Since Label Studio works by making requests to endpoints, when it comes to displaying the images, it will default to the Minio configuration which you have correctly set up. However, due to the use of relative paths, the images may not be retrieved/displayed correctly.

To resolve this, ensure you set the LABEL_STUDIO_HOST environment variable in your docker-compose.yml to the appropriate host that Label Studio should use. This way, it will generate absolute paths, which should correct the issue of images not being displayed.

In summary, your images are being uploaded correctly because Minio is correctly configured, but they are not being displayed due to the use of relative paths by Label Studio. Setting the host appropriately should fix this issue.

In case this does not fix your issue, you may refer to the link to the link for other important environment variables. [1]: https://github.com/HumanSignal/label-studio/blob/adc2475e6089c57ff23eb4a933890e43762176e7/docs/source/guide/start.md?plain=1#L52