kien bui: Hi!
Do you know about condition to load dynamic label?
Example: I want to get list of choices label from attributes with structure format attributes: [{ code: “a”; value:“val_a”}, { code: “b”; value:“val_b”},{ code: “c”; value:“val_c”},{ code: “d”; value:“val_d”}, ]
<Choices name="example" value="$attributes[code=a].value">
Tyler Conlee (HumanSignal): Yes, you can load dynamic labels from a list of choices in your task data. Here’s an example of how you can do it:
Your task JSON should look like this:
{
"id": 1,
"data": {
"text": "Your text to classify goes here.",
"attributes": [
{ "code": "a", "value":"val_a" },
{ "code": "b", "value":"val_b" },
{ "code": "c", "value":"val_c" },
{ "code": "d", "value":"val_d" }
]
}
}
In your labeling configuration, you can use the Choices
tag with the value
attribute set to $attributes
. This will load the choices from the attributes
list in your task data. Each choice will be created with the value
attribute set to the value
field of the corresponding item in the attributes
list.
Here’s an example of how your labeling configuration might look:
<View>
<Text name="text" value="$text"/>
<Choices name="choices" toName="text" value="$attributes">
</Choices>
</View>
In this configuration, each choice will be displayed with the text from the value
field of the corresponding item in the attributes
list. The code
field can be used as an alias for the choice.
Note: This post was generated by the Label Studio Archive Bot from a conversation in the Label Studio Slack, a gathering place for the Label Studio community. Someone in the community thought this was worth sharing!
If this post answered a question for you, hit the Like button - we use that to assess which posts to put into docs.