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

Pre-annotations of TextArea #120

Closed
michaelachmann opened this issue Apr 6, 2023 · 3 comments
Closed

Pre-annotations of TextArea #120

michaelachmann opened this issue Apr 6, 2023 · 3 comments
Labels
question Further information is requested

Comments

@michaelachmann
Copy link

michaelachmann commented Apr 6, 2023

I ran into trouble when adding pre annotations using the SDK for textareas. Here's my initial bug report: HumanSignal/label-studio#3941

I think there might still be a bug in the SDK causing the uploaded tasks pre-annotations to contain the following

"value": {
  "textarea": [
    "... transcription ..."
  ]
},

instead of

"value": {
  "text": [
    "... transcription ..."
  ]
},
@makseq makseq pinned this issue Apr 6, 2023
@makseq
Copy link
Member

makseq commented Apr 6, 2023

Could you please share your SDK code where you create pre-annotations?

@michaelachmann
Copy link
Author

Sure, it's basically these two steps:

  1. Create a new project and Interface:
interface = """
<View>
  <Audio name="audio" value="$audio" zoom="true" hotkey="ctrl+enter" />
  <Header value="Provide Transcription" />
  <TextArea name="transcript" toName="audio"
            rows="5" editable="true" maxSubmissions="1" />
</View>
"""

project_name = "Audio Project" 
ls = Client(url=labelstudio_url, api_key=labelstudio_key)
project = ls.start_project(
    title=project_name,
    label_config=interface,
)
  1. Upload Tasks with pre-annotations
project.import_tasks(
        df_tasks.to_dict('records'),
        preannotated_from_fields=['transcript'])

@makseq
Copy link
Member

makseq commented Apr 12, 2023

it won't work this way, because preannotatored from fields work for choices only.
Check this video https://labelstud.io/guide/predictions.html#Prepare-pre-annotations-for-Label-Studio
and prepare your annotation json following this video tutorial.

Also check this example:
https://github.com/heartexlabs/label-studio-sdk/blob/master/examples/import_preannotations/import_preannotations.py#L29

@makseq makseq closed this as completed Apr 12, 2023
@makseq makseq added the question Further information is requested label Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants