-
Notifications
You must be signed in to change notification settings - Fork 0
Sample labeling config for pausing annotators #3
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
Merged
Merged
Changes from 9 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
80a0e82
Merge pull request #2 from HumanSignal/fb-leap-1834/readable-pause-sc…
hlomzik ad426f9
Add sample labeling config
smohan123 aa463d4
feat: LEAP-1683: Custom scripts dropdown
nass600 545ae1b
Merge pull request #4 from HumanSignal/fb-leap-1683/custom-scripts
smohan123 565e25a
feat: LEAP-1683: Adapted structure and improved docs
nass600 54c21ca
Merge pull request #5 from HumanSignal/fb-leap-1683/custom-scripts
nass600 1fbd209
feat: LEAP-1683: Aded banner
nass600 7839fc4
feat: LEAP-1972: Ensure initial plugins are ready for release
nass600 8434ec9
Merge pull request #6 from HumanSignal/fb-leap-1972/ensure-initial-state
nass600 9cd38a7
docs: Edit manifest
caitlinwheeless 2d465cf
Couple more fixes
caitlinwheeless 4134e06
Incorporating Alec's comments
caitlinwheeless 75fd2ab
Merge pull request #7 from HumanSignal/docs/update-manifest
nass600 4d71df7
fix: LEAP-1972: Minor improvements
nass600 5e8cbbd
Merge pull request #8 from HumanSignal/fb-leap-1972/ensure-initial-state
nass600 2e7f704
feat: LEAP-1984: Rename Custom Scripts to Plugins
nass600 3cbc49d
applied biome and changed ci
nass600 1d1cf96
standardized src folder
nass600 62a7511
biome fixes
nass600 719e8ee
fixed redact pii
nass600 1b083c7
Merge pull request #9 from HumanSignal/fb-leap-1984/rename-plugins
nass600 9a42248
Update README.md
nass600 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
## Description | ||
|
||
<!-- A brief description of what this PR accomplishes. Include any screenshots if helpful. --> | ||
|
||
## Related Issues | ||
|
||
<!-- If this PR fixes an issue, link it here (e.g. Fixes #123). --> | ||
|
||
## Checklist | ||
|
||
- [ ] I have tested the changes in the Label Studio Labeling Config. | ||
- [ ] I have added the `script.js` file. | ||
- [ ] I have added the `view.xml` file. | ||
- [ ] My code follows the guidelines stated in the README.md. | ||
|
||
<!-- Thanks for contributing to Awesome Label Studio Configs! --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Validate Folder Structure | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
check-structure: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
|
||
- name: Run Folder Structure Check | ||
run: node validate-structure.mjs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,73 @@ | ||
# label-studio-custom-scripts | ||
 | ||
|
||
# Label Studio Custom Scripts | ||
|
||
Welcome to **Label Studio Custom Scripts**! This repository contains `custom scripts` designed to extend the functionality of [Label Studio](https://labelstud.io), a powerful data labeling tool. These scripts can be used to automate workflows, integrate with external tools, and customize the labeling process according to your needs. | ||
|
||
Whether you're building custom data processors, integrations, or UI components, you'll find the necessary resources and examples in this repo to get started. | ||
|
||
## Official Documentation | ||
|
||
For detailed documentation and guides on how to use and extend Label Studio with custom scripts, visit the official [Label Studio Scripts Documentation](https://docs.humansignal.com/guide/scripts). | ||
|
||
## File Structure | ||
|
||
This repository follows a clear folder structure to organize the various custom scripts and configuration files: | ||
|
||
```bash | ||
label-studio-custom-scripts/ | ||
├── custom-scripts/ | ||
│ ├── script1/ | ||
│ │ ├── data.{json|mp3|mp4} | ||
│ │ ├── script.js | ||
│ │ └── view.xml | ||
│ ├── script2/ | ||
│ │ ├── data.{json|mp3|mp4} | ||
│ │ ├── script.js | ||
│ │ └── view.xml | ||
│ └── ... | ||
└── manifest.json | ||
``` | ||
|
||
- **`/script1`**: Contains all the files to document a custom script. | ||
- Each script has a `script.js` and `view.xml` file that define the logic and UI of the script. | ||
- **`/script.js`**: Contains the actual custom script `javascript` file that can be embedded in the Label Studio code editor. | ||
- **`/view.xml`**: Stores an example of a `<View>` that will work along the script. | ||
- **`/data.{json|mp3|mp4}`**: Stores an example of the data that can be used along with the script. | ||
- **`manifest.json`**: This file lists the scripts, their metadata (title, description, etc.), and their paths for easy integration with Label Studio. | ||
|
||
## Usage | ||
|
||
After your script gets merged you will be able to find it in your project's **Labeling Interface** | ||
|
||
 | ||
|
||
## Contributing | ||
|
||
We welcome contributions! Whether it's bug fixes or new scripts, feel free to open a pull request. Here's how you can get started: | ||
|
||
1. **Create a new branch** for your feature or bugfix. | ||
2. **Make your changes** and ensure that they adhere to the project's file structure and guidelines. You need to create a folder with the name using underscores (`path`) of your script and add a `view.xml` and a `script.js` file minimum. | ||
3. **Register the script** in the `manifest.json` adding the following information: | ||
```json | ||
[ | ||
{ | ||
"title": "Your script title", | ||
"description": "Your script description", | ||
"path": "exact_name_of_the_script_folder", // `script1` as per the File Structure example | ||
"private": false // whether you want to hide it in the "Insert Script" dropdown in the Configurator code tab | ||
} | ||
] | ||
``` | ||
4. **Test your changes** to ensure everything works as expected. | ||
5. **Submit a pull request** explaining the changes you made. | ||
|
||
Please make sure that your contributions follow the existing code style and structure. | ||
|
||
## License | ||
|
||
This software is licensed under the [Apache 2.0 LICENSE](/LICENSE) © [Heartex](https://www.heartex.com/). 2020-2025 | ||
|
||
--- | ||
|
||
If you have any questions or need assistance, feel free to reach out through issues or discussions. We look forward to your contributions! |
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
11 changes: 10 additions & 1 deletion
11
bulk_labeling/js.txt → custom-scripts/bulk-labeling/script.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<View> | ||
<Labels name="label" toName="text"> | ||
<Label value="PER" background="red"/> | ||
<Label value="ORG" background="darkorange"/> | ||
<Label value="LOC" background="orange"/> | ||
<Label value="MISC" background="green"/> | ||
</Labels> | ||
|
||
<Text name="text" value="$text"/> | ||
</View> | ||
|
||
<!-- | ||
{ | ||
"data": { | ||
"text": [ | ||
"Opossums, commonly known as possums in North America, are marsupials found primarily in the Americas. The most well-known species is the Virginia opossum (Didelphis virginiana), which ranges from Central America and the eastern United States to southern Canada. These adaptable creatures are known for their ability to thrive in a variety of environments, including both rural and urban areas. Opossums are also found in South America, where different species inhabit a range of ecosystems, from tropical rainforests to temperate forests.", | ||
"Opossums are highly adaptable in terms of habitat, often residing in woodlands, farmland, and even suburban backyards. They typically seek shelter in hollow trees, abandoned burrows, or any dark, enclosed space they can find. Opossums are nocturnal and omnivorous, with a diet that includes fruits, insects, small animals, and even carrion. Their opportunistic feeding habits contribute to their resilience and ability to live in close proximity to human settlements.", | ||
"In terms of behavior, opossums are solitary and nomadic, often moving to different locations in search of food. They are known for their unique defense mechanism of 'playing dead' or 'playing possum' when threatened, which involves mimicking the appearance and smell of a sick or dead animal to deter predators. Opossums have relatively short lifespans, typically living only 2 to 4 years in the wild. Despite their short lives, they reproduce quickly, with females giving birth to large litters of up to 20 young, although not all offspring typically survive to maturity.", | ||
"In popular culture, opossums often appear as symbols of resilience and survival due to their hardy nature and ability to adapt to various environments. They are sometimes depicted in a comical or misunderstood light, given their nocturnal habits and somewhat disheveled appearance. Despite this, they play a crucial role in the ecosystem by controlling insect and rodent populations and cleaning up carrion. Opossums have been featured in various forms of media, from cartoons and children's books to movies, often emphasizing their unique behaviors and survival strategies." | ||
] | ||
} | ||
} | ||
--> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"data": { | ||
"text": "The quick brown fox jumps over the lazy dog." | ||
} | ||
} |
File renamed without changes
13 changes: 10 additions & 3 deletions
13
count_words_in_textarea/js.txt → ...scripts/count-words-in-textarea/script.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
/** | ||
* Validates the word count of the entered text to prevent submission if it exceeds a specified threshold | ||
*/ | ||
|
||
let dismissed = false; | ||
|
||
LSI.on("beforeSaveAnnotation", (store, annotation) => { | ||
const textAreaResult = annotation.results.find(r => r.type === 'textarea' && r.from_name.name === 'textarea'); | ||
|
||
if (textAreaResult) { | ||
words = textAreaResult.value.text[0] | ||
word_count = words.split(" ").length; | ||
|
||
if (word_count > 10) { | ||
Htx.showModal("Word count is " + word_count + ". Please reduce to 10 or less."); | ||
dismissed = true; | ||
return false; | ||
return false; // Block submission | ||
} | ||
} | ||
return true; | ||
}); | ||
|
||
return true; // Allow submission | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<View> | ||
<Header value="Classify the text in less than 10 words"/> | ||
<Text name="text" value="$text"/> | ||
<TextArea name="textarea" toName="text" /> | ||
</View> | ||
|
||
<!-- | ||
{ | ||
"data": { | ||
"text": "The quick brown fox jumps over the lazy dog.", | ||
} | ||
} | ||
--> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"data": { | ||
"image": "/static/custom-scripts/custom-scripts/show_different_images_based_on_label_selected/img/demo-sample.png" | ||
} | ||
} |
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11.3 KB
custom-scripts/different-images-per-label/img/demo-routing-number.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<View> | ||
<View> | ||
<Image name="image" value="$image" /> | ||
<Labels name="label" toName="image"> | ||
<Label value="Addressee" background="gray" maxUsages="1" /> | ||
<Label value="Account number" background="magenta" maxUsages="1" /> | ||
<Label value="Routing number" background="green" maxUsages="1" /> | ||
<Label value="Signature" background="red" maxUsages="1" /> | ||
<Label value="Amount" background="orange" maxUsages="2" /> | ||
<Label value="Watermark" background="purple" /> | ||
<Label value="Date" background="brown" maxUsages="1" /> | ||
<Label value="Correction" background="black" maxUsages="1" /> | ||
</Labels> | ||
<Rectangle name="bbox" toName="image" strokeWidth="3" /> | ||
</View> | ||
<View> | ||
<Header value="Example" /> | ||
<Header value="(Please make a selection)" size="5" /> | ||
</View> | ||
</View> | ||
|
||
<!-- | ||
{ | ||
"data": { | ||
"image": "/static/custom-scripts/custom-scripts/show_different_images_based_on_label_selected/img/demo-sample.png" | ||
} | ||
} | ||
--> |
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.