label-studio-ml-backend icon indicating copy to clipboard operation
label-studio-ml-backend copied to clipboard

Segment-Anything Unauthorized error when accessing a public resource

Open fcuenca4 opened this issue 1 year ago • 2 comments

I'm encountering a 401 error while utilizing SAM with a remote GCS URL, despite being certain the URL is public. I'm attempting to upload a large JSON file of images via a GCS bucket, but the process fails when invoking the SAM endpoint. It appears the issue stems from this specific line of code: https://github.com/HumanSignal/label-studio-ml-backend/blob/193e24e95539371f53d93d6bee3d8cf684326857/label_studio_ml/utils.py#L66

According to the official documentation, the authentication token should be a Label Studio authentication token. However, using it results in an erroneous Authorization token being added to the request. This is the get_local_path function from the public tools repo: https://github.com/HumanSignal/label-studio-tools/blob/eef952c953fc3c4ed27a276e112ce65f313b7b0a/label_studio_tools/core/utils/io.py#L103

fcuenca4 avatar Feb 05 '24 22:02 fcuenca4

setting access_token as None makes remote public calls successful but it fails when calling label-studio for obvious reasons.

    image_local_path = get_local_path(
        url=url,
        cache_dir=image_cache_dir,
        project_dir=project_dir,
        hostname=label_studio_host or get_env('HOSTNAME'),
        image_dir=image_dir,
        access_token=None
    )

am I missing any configurations? is this intended?

Thanks :)

fcuenca4 avatar Feb 05 '24 22:02 fcuenca4

@fcuenca4 There is currently a bug preventing the simultaneous use of publicly hosted images and those hosted by Label Studio. This PR will fix the issue.

niklub avatar Mar 20 '24 06:03 niklub