Skip to content

Commit 25ee12a

Browse files
authored
docs: Minor format changes for image captioning example (#6916)
1 parent 33b63e9 commit 25ee12a

File tree

2 files changed

+74
-76
lines changed

2 files changed

+74
-76
lines changed

docs/source/guide/prompts_examples.md

+74-16
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,78 @@ section: Prompts
1111
date: 2025-01-15 12:11:22
1212
---
1313

14+
## Example project types
1415

15-
## Autolabel image captions
16+
### Text classification
17+
18+
Text classification is the process of assigning predefined categories or labels to segments of text based on their content. This involves analyzing the text and determining which category or label best describes its subject, sentiment, or purpose. The goal is to organize and categorize textual data in a way that makes it easier to analyze, search, and utilize.
19+
20+
Text classification labeling tasks are fundamental in many applications, enabling efficient data organization, improving searchability, and providing valuable insights through data analysis. Some examples include:
21+
22+
* **Spam Detection**: Classifying emails as "spam" or "ham" (not spam).
23+
* **Sentiment Analysis**: Categorizing user reviews as "positive," "negative," or "neutral."
24+
* **Topic Categorization**: Assigning articles to categories like "politics," "sports," "technology," etc.
25+
* **Support Ticket Classification**: Labeling customer support tickets based on the issue type, such as "billing," "technical support," or "account management."
26+
* **Content Moderation**: Identifying and labeling inappropriate content on social media platforms, such as "offensive language," "hate speech," or "harassment."
27+
28+
### Named entity recognition (NER)
29+
30+
A Named Entity Recognition (NER) labeling task involves identifying and classifying named entities within text. For example, people, organizations, locations, dates, and other proper nouns. The goal is to label these entities with predefined categories that make the text easier to analyze and understand. NER is commonly used in tasks like information extraction, text summarization, and content classification.
31+
32+
For example, in the sentence "Heidi Opossum goes grocery shopping at Aldi in Miami" the NER task would involve identifying "Aldi" as a place or organization, "Heidi Opossum" as a person (even though, to be precise, she is an iconic opossum), and "Miami" as a location. Once labeled, this structured data can be used for various purposes such as improving search functionality, organizing information, or training machine learning models for more complex natural language processing tasks.
33+
34+
NER labeling is crucial for industries such as finance, healthcare, and legal services, where accurate entity identification helps in extracting key information from large amounts of text, improving decision-making, and automating workflows.
35+
36+
Some examples include:
37+
38+
* **News and Media Monitoring**: Media organizations use NER to automatically tag and categorize entities such as people, organizations, and locations in news articles. This helps in organizing news content, enabling efficient search and retrieval, and generating summaries or reports.
39+
* **Intelligence and Risk Analysis**: By extracting entities such as personal names, organizations, IP addresses, and financial transactions from suspicious activity reports or communications, organizations can better assess risks and detect fraud or criminal activity.
40+
* **Specialized Document Review**: Once trained, NER can help extract industry-specific key entities for better document review, searching, and classification.
41+
* **Customer Feedback and Product Review**: Extract named entities like product names, companies, or services from customer feedback or reviews. This allows businesses to categorize and analyze feedback based on specific products, people, or regions, helping them make data-driven improvements.
42+
43+
### Text summarization
44+
45+
Text summarization involves condensing large amounts of information into concise, meaningful summaries.
46+
47+
Models can be trained or fine-tuned to recognize essential information within a document and generate summaries that retain the core ideas while omitting less critical details. This capability is especially valuable in today’s information-heavy landscape, where professionals across various fields are often overwhelmed by the sheer volume of text data.
48+
49+
Some examples include:
50+
51+
* **Customer Support and Feedback Analysis**: Companies receive vast volumes of customer support tickets, reviews, and feedback that are often repetitive or lengthy. Auto-labeling can help summarize these inputs, focusing on core issues or themes, such as “billing issues” or “technical support.”
52+
* **News Aggregation and Media Monitoring**: News organizations and media monitoring platforms need to process and distribute news stories efficiently. Auto-labeling can summarize articles while tagging them with labels like “politics,” “economy,” or “health,” making it easier for users to find relevant stories.
53+
* **Document Summarization**: Professionals often need to quickly understand the key points in lengthy contracts, research papers, and files.
54+
* **Educational Content Summarization**: EEducators and e-learning platforms need to distill complex material into accessible summaries for students. Auto-labeling can summarize key topics and categorize them under labels like “concept,” “example,” or “important fact.”
55+
56+
57+
### Image captioning and classification
58+
59+
Image captioning involves applying descriptive text for images. This has valuable applications across industries, particularly where visual content needs to be systematically organized, analyzed, or made accessible.
60+
61+
You can also use Prompts to automatically categorizing images into predefined classes or categories, ensuring consistent labeling of large image datasets.
62+
63+
Some examples include:
64+
65+
* **E-commerce Product Cataloging**: Online retailers often deal with thousands of product images that require captions describing their appearance, features, or categories.
66+
67+
* **Digital Asset Management (DAM)**: Companies managing large libraries of images, such as marketing teams, media organizations, or creative agencies, can use auto-labeling to caption, tag, and classify their assets.
68+
69+
* **Content Moderation and Analysis**: Platforms that host user-generated content can employ image captioning to analyze and describe uploaded visuals. This helps detect inappropriate content, categorize posts (e.g., "Outdoor landscape with a sunset"), and surface relevant content to users. You may also want to train a model to classify image uploads into categories such as “safe,” “explicit,” or “spam.”
70+
71+
* **Accessibility for Visually Impaired Users**: Image captioning is essential for making digital content more accessible to visually impaired users by providing descriptive alt-text for images on websites, apps, or documents. For instance, an image of a cat playing with yarn might generate the caption, "A fluffy orange cat playing with a ball of blue yarn."
72+
73+
## Example Walkthroughs
74+
75+
### Autolabel image captions
1676

1777
This example demonstrates how to set up Prompts to predict image captions.
1878

1979
1. [Create a new label studio project](setup_project) by importing image data via [cloud storage](storage).
2080

81+
If you’d like to, you can generate a dataset to test the process using [https://data.heartex.net](https://data.heartex.net).
82+
2183
!!! note
2284
Prompts does not currently support image data uploaded as raw images. Only image references (HTTP URIs to images) or images imported via cloud storage are supported.
2385

24-
!!! info Tip
25-
If you’d like to, you can generate a dataset to test the process using [https://data.heartex.net](https://data.heartex.net).
26-
2786
2. Create a [label config](setup) for image captioning, for example:
2887

2988
```xml
@@ -36,7 +95,6 @@ This example demonstrates how to set up Prompts to predict image captions.
3695
```
3796
3. Navigate to **Prompts** from the sidebar, and [create a prompt](prompts_create) for the project
3897

39-
!!! note
4098
If you have not yet set up API the keys you want to use, do that now: [API keys](prompts_create#Model-provider-API-keys).
4199

42100
4. Add the instruction you’d like to provide the LLM to caption your images. For example:
@@ -46,12 +104,12 @@ This example demonstrates how to set up Prompts to predict image captions.
46104
!!! note
47105
Ensure you include `{image}` in your instructions. Click `image` above the instruction field to insert it.
48106

49-
![Screenshot pointing to how to insert image into your instructions](/images/prompts/example_insert_image.png)
107+
![Screenshot pointing to how to insert image into your instructions](/images/prompts/example_insert_image.png)
50108

51109
!!! info Tip
52110
You can also automatically generate the instructions using the [**Enhance Prompt** action](prompts_draft#Enhance-prompt). Before you can use this action, you must at least add the variable name `{image}` and then click **Save**.
53111

54-
![Screenshot pointing to Enhance Prompt action](/images/prompts/example_enhance_prompt.png)
112+
![Screenshot pointing to Enhance Prompt action](/images/prompts/example_enhance_prompt.png)
55113

56114
5. Run the prompt. View predictions to accept or correct.
57115

@@ -60,18 +118,19 @@ This example demonstrates how to set up Prompts to predict image captions.
60118
!!! info Tip
61119
Use the drop-down menu above the results field to change the subset of data being used (e.g. only data with Ground Truth annotations, or a small sample of records).
62120

63-
![Screenshot pointing to subset dropdown](/images/prompts/example_subset.png)
121+
![Screenshot pointing to subset dropdown](/images/prompts/example_subset.png)
64122

65123
6. Accept the [predictions as annotations](prompts_predictions#Create-annotations-from-predictions).
66124

67125

68-
## Evaluate LLM outputs for toxicity
126+
### Evaluate LLM outputs for toxicity
69127

70128
This example demonstrates how to set up Prompts to evaluate if the LLM-generated output text is classified as harmful, offensive, or inappropriate.
71129

72130
1. [Create a new label studio project](setup_project) by importing text data of LLM-generated outputs.
73131

74-
You can use this preprocessed sample of the [jigsaw_toxicity](https://huggingface.co/datasets/tasksource/jigsaw_toxicity) dataset as an example. See [the appendix](#Appendix-Generate-dataset) for how this was generated.
132+
For example: you can use the [jigsaw_toxicity](https://huggingface.co/datasets/tasksource/jigsaw_toxicity) dataset as an example. See [the appendix](#Appendix-Generate-dataset) for how you can pre-process and (optionally) downsample this dataset to use with this guide.
133+
75134
2. Create a [label config](setup) for toxicity detection, for example:
76135

77136
```xml
@@ -117,7 +176,6 @@ This example demonstrates how to set up Prompts to evaluate if the LLM-generated
117176

118177
3. Navigate to **Prompts** from the sidebar, and [create a prompt](prompts_create) for the project
119178

120-
!!! note
121179
If you have not yet set up API the keys you want to use, do that now: [API keys](prompts_create#Model-provider-API-keys).
122180

123181
4. Add the instruction you’d like to provide the LLM to best evaluate the text. For example:
@@ -134,12 +192,12 @@ This example demonstrates how to set up Prompts to evaluate if the LLM-generated
134192
!!! note
135193
Ensure you include `{comment_text}` in your instructions. Click `comment_text` above the instruction field to insert it.
136194

137-
![Screenshot pointing to how to insert comment text into your instructions](/images/prompts/example_insert_comment_text.png)
195+
![Screenshot pointing to how to insert comment text into your instructions](/images/prompts/example_insert_comment_text.png)
138196

139197
!!! info Tip
140198
You can also automatically generate the instructions using the [**Enhance Prompt** action](prompts_draft#Enhance-prompt). Before you can use this action, you must at least add the variable name `{comment_text}` and then click **Save**.
141199

142-
![Screenshot pointing to Enhance Prompt action](/images/prompts/example_enhance_prompt2.png)
200+
![Screenshot pointing to Enhance Prompt action](/images/prompts/example_enhance_prompt2.png)
143201

144202
5. Run the prompt. View predictions to accept or correct.
145203

@@ -148,11 +206,11 @@ This example demonstrates how to set up Prompts to evaluate if the LLM-generated
148206
!!! info Tip
149207
Use the drop-down menu above the results field to change the subset of data being used (e.g. only data with Ground Truth annotations, or a small sample of records).
150208

151-
![Screenshot pointing to subset dropdown](/images/prompts/example_subset2.png)
209+
![Screenshot pointing to subset dropdown](/images/prompts/example_subset2.png)
152210

153211
6. Accept the [predictions as annotations](prompts_predictions#Create-annotations-from-predictions).
154212

155-
### Appendix: Generate dataset
213+
### Appendix: Preprocess jigsaw toxicity dataset
156214

157215
Download the jigsaw_toxicity dataset, then downsample/format using the following script (modify the `INPUT_PATH` and `OUTPUT_PATH` to suit your needs):
158216

@@ -200,4 +258,4 @@ with open(OUTPUT_PATH, "w") as f:
200258
json.dump(label_studio_tasks, f)
201259
```
202260

203-
If you choose to, you could also easily change how many records to use (or use the entire dataset by removing the sample step).
261+
If you choose to, you could also easily change how many records to use (or use the entire dataset by removing the sample step).

docs/source/guide/prompts_overview.md

-60
Original file line numberDiff line numberDiff line change
@@ -144,63 +144,3 @@ This feedback loop allows you to iteratively fine-tune your prompts, optimizing
144144

145145
![Diagram of fine-tuning workflow](/images/prompts/tuning-diagram.png)
146146

147-
148-
## Example project types
149-
150-
### Text classification
151-
152-
Text classification is the process of assigning predefined categories or labels to segments of text based on their content. This involves analyzing the text and determining which category or label best describes its subject, sentiment, or purpose. The goal is to organize and categorize textual data in a way that makes it easier to analyze, search, and utilize.
153-
154-
Text classification labeling tasks are fundamental in many applications, enabling efficient data organization, improving searchability, and providing valuable insights through data analysis. Some examples include:
155-
156-
* **Spam Detection**: Classifying emails as "spam" or "ham" (not spam).
157-
* **Sentiment Analysis**: Categorizing user reviews as "positive," "negative," or "neutral."
158-
* **Topic Categorization**: Assigning articles to categories like "politics," "sports," "technology," etc.
159-
* **Support Ticket Classification**: Labeling customer support tickets based on the issue type, such as "billing," "technical support," or "account management."
160-
* **Content Moderation**: Identifying and labeling inappropriate content on social media platforms, such as "offensive language," "hate speech," or "harassment."
161-
162-
### Named entity recognition (NER)
163-
164-
A Named Entity Recognition (NER) labeling task involves identifying and classifying named entities within text. For example, people, organizations, locations, dates, and other proper nouns. The goal is to label these entities with predefined categories that make the text easier to analyze and understand. NER is commonly used in tasks like information extraction, text summarization, and content classification.
165-
166-
For example, in the sentence "Heidi Opossum goes grocery shopping at Aldi in Miami" the NER task would involve identifying "Aldi" as a place or organization, "Heidi Opossum" as a person (even though, to be precise, she is an iconic opossum), and "Miami" as a location. Once labeled, this structured data can be used for various purposes such as improving search functionality, organizing information, or training machine learning models for more complex natural language processing tasks.
167-
168-
NER labeling is crucial for industries such as finance, healthcare, and legal services, where accurate entity identification helps in extracting key information from large amounts of text, improving decision-making, and automating workflows.
169-
170-
Some examples include:
171-
172-
* **News and Media Monitoring**: Media organizations use NER to automatically tag and categorize entities such as people, organizations, and locations in news articles. This helps in organizing news content, enabling efficient search and retrieval, and generating summaries or reports.
173-
* **Intelligence and Risk Analysis**: By extracting entities such as personal names, organizations, IP addresses, and financial transactions from suspicious activity reports or communications, organizations can better assess risks and detect fraud or criminal activity.
174-
* **Specialized Document Review**: Once trained, NER can help extract industry-specific key entities for better document review, searching, and classification.
175-
* **Customer Feedback and Product Review**: Extract named entities like product names, companies, or services from customer feedback or reviews. This allows businesses to categorize and analyze feedback based on specific products, people, or regions, helping them make data-driven improvements.
176-
177-
### Text summarization
178-
179-
Text summarization involves condensing large amounts of information into concise, meaningful summaries.
180-
181-
Models can be trained or fine-tuned to recognize essential information within a document and generate summaries that retain the core ideas while omitting less critical details. This capability is especially valuable in today’s information-heavy landscape, where professionals across various fields are often overwhelmed by the sheer volume of text data.
182-
183-
Some examples include:
184-
185-
* **Customer Support and Feedback Analysis**: Companies receive vast volumes of customer support tickets, reviews, and feedback that are often repetitive or lengthy. Auto-labeling can help summarize these inputs, focusing on core issues or themes, such as “billing issues” or “technical support.”
186-
* **News Aggregation and Media Monitoring**: News organizations and media monitoring platforms need to process and distribute news stories efficiently. Auto-labeling can summarize articles while tagging them with labels like “politics,” “economy,” or “health,” making it easier for users to find relevant stories.
187-
* **Document Summarization**: Professionals often need to quickly understand the key points in lengthy contracts, research papers, and files.
188-
* **Educational Content Summarization**: EEducators and e-learning platforms need to distill complex material into accessible summaries for students. Auto-labeling can summarize key topics and categorize them under labels like “concept,” “example,” or “important fact.”
189-
190-
191-
### Image captioning and classification
192-
193-
Image captioning involves applying descriptive text for images. This has valuable applications across industries, particularly where visual content needs to be systematically organized, analyzed, or made accessible.
194-
195-
You can also use Prompts to automatically categorizing images into predefined classes or categories, ensuring consistent labeling of large image datasets.
196-
197-
Some examples include:
198-
199-
* **E-commerce Product Cataloging**: Online retailers often deal with thousands of product images that require captions describing their appearance, features, or categories.
200-
201-
* **Digital Asset Management (DAM)**: Companies managing large libraries of images, such as marketing teams, media organizations, or creative agencies, can use auto-labeling to caption, tag, and classify their assets.
202-
203-
* **Content Moderation and Analysis**: Platforms that host user-generated content can employ image captioning to analyze and describe uploaded visuals. This helps detect inappropriate content, categorize posts (e.g., "Outdoor landscape with a sunset"), and surface relevant content to users. You may also want to train a model to classify image uploads into categories such as “safe,” “explicit,” or “spam.”
204-
205-
* **Accessibility for Visually Impaired Users**: Image captioning is essential for making digital content more accessible to visually impaired users by providing descriptive alt-text for images on websites, apps, or documents. For instance, an image of a cat playing with yarn might generate the caption, "A fluffy orange cat playing with a ball of blue yarn."
206-

0 commit comments

Comments
 (0)