HumanSignal / label-studio-ml-backend

Configs and boilerplates for Label Studio's Machine Learning backend
Apache License 2.0
587 stars 261 forks source link

Workaround to avoid duplicate annotations #618

Open cgrtrifork opened 2 months ago

cgrtrifork commented 2 months ago

https://github.com/HumanSignal/label-studio/issues/6312 causes an extra call to predict when 'Submit' is clicked, causing duplicate predictions. This is a workaround that shouldn't impact the functionality (handling an edge case that shouldn't happen anyway) and will prevent the problem by returning empty annotations the second time (when the prompt is duplicated).

This assumes the auto-annotation has been used before clicking submit. If it weren't used then the prompt length would be 1 and this fix wouldn't work. As stated, this is a workaround, the real fix should be to avoid LabelStudio calling the prediction endpoint on submit.

codecov-commenter commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 46.97%. Comparing base (38974da) to head (73fc1f2). Report is 2 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #618 +/- ## ========================================== - Coverage 49.13% 46.97% -2.17% ========================================== Files 41 11 -30 Lines 2825 611 -2214 ========================================== - Hits 1388 287 -1101 + Misses 1437 324 -1113 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.