Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to initialize label studio instance with customized settings in frontend #6964

Closed
longapple opened this issue Jan 25, 2025 · 3 comments
Closed

Comments

@longapple
Copy link

Hi team,

I'm using the following code (based on LSF 1.15.0) to initialize a LS instance:

        LS = new window.LabelStudio('label-studio', {
            config: image_config,
            interfaces: [
                "infobar",
                "side-column",
                "controls",
                "infobar",
                "topbar",
                "auto-annotation",
              
            ],
            settings: {
                showLabels: false,
            },
           ...
          }

What I want to achieve is that to not show the labels in annotations by default. But this doesn't seem to work. The label always shows up no matter what value I provide to settings.showLabels.

Is this the correct way to initialize settings for an LS instance?

Thanks in advance.

@heidi-humansignal
Copy link
Collaborator

Hello,

Thanks for reaching out!

In Label Studio Frontend (LSF) v1.15, passing settings: { showLabels: false } sometimes doesn’t hide the labels as expected. This behavior was noted in earlier GitHub issues where the default value in code was set to false, but labels appeared anyway.

Possible workarounds and suggestions:

  1. Use the LSF user interface.

In the labeling view, click the gear (settings) icon and uncheck “Show region labels.” That effectively hides labels for your bounding boxes or other object regions.
2. Adjust flags programmatically.

If you need a purely code-based approach, you can try manually setting the flag right after the instance initializes. For example:

_var LS = new LabelStudio("label-studio", {_
_config: image_config,_
_interfaces: [...],_
_});_
_LS.setFlags({ showLabels: false });_

(Note that this approach can vary depending on the specific LSF version.)

We also recommend upgrading to v1.16+ if possible because this version includes fixes and a more reliable settings flow.

Please let me know if you have any other questions

Comment by Oussama Assili
Workflow Run

@longapple
Copy link
Author

Thanks a lot. The second method works great for me.

@heidi-humansignal
Copy link
Collaborator

Great! it has been a pleasure to support you.

Please feel free to reach out if you have additional inquires. For now , i will close this ticket.

Comment by Oussama Assili
Workflow Run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants