Skip to content

Commit 86bb75d

Browse files
storage guide
1 parent 0b628dd commit 86bb75d

File tree

1 file changed

+46
-28
lines changed

1 file changed

+46
-28
lines changed

docs/source/guide/storage.md

Lines changed: 46 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,9 @@ When disabled, tasks in JSON format can be loaded directly from storage buckets
7777

7878
<img src="/images/source-storages-treat-off.png" class="make-intense-zoom">
7979

80-
###### On
81-
82-
When enabled, Label Studio automatically lists files from the storage bucket and constructs tasks. This is only possible for simple labeling tasks that involve a single media source (such as an image, text, etc.).*
83-
84-
<img src="/images/source-storages-treat-on.png" class="make-intense-zoom">
85-
86-
87-
#### One Task - One JSON File
88-
89-
If you plan to load JSON tasks from the Source Storage (`Treat every bucket object as a source file = No`), you must place only one task as the **dict** per one JSON file. Otherwise, Label Studio will not load your data properly.
80+
You may put multiple tasks inside the same JSON file, but not mix task formats inside the same file.
9081

91-
{% details <b>Example with tasks in separate JSON files</b> %}
82+
{% details <b>Example with bare tasks</b> %}
9283

9384

9485
`task_01.json`
@@ -107,11 +98,27 @@ If you plan to load JSON tasks from the Source Storage (`Treat every bucket obje
10798
}
10899
```
109100

101+
Or:
102+
103+
`tasks.json`
104+
```
105+
[
106+
{
107+
"image": "s3://bucket/1.jpg",
108+
"text": "opossums are awesome"
109+
},
110+
{
111+
"image": "s3://bucket/2.jpg",
112+
"text": "cats are awesome"
113+
}
114+
]
115+
```
116+
110117
{% enddetails %}
111118

112119
<br>
113120

114-
{% details <b>Example with tasks, annotations and predictions in separate JSON files</b> %}
121+
{% details <b>Example with tasks, annotations and predictions</b> %}
115122

116123
`task_with_predictions_and_annotations_01.json`
117124
```
@@ -137,28 +144,39 @@ If you plan to load JSON tasks from the Source Storage (`Treat every bucket obje
137144
}
138145
```
139146

140-
{% enddetails %}
141-
142-
<br>
147+
Or:
143148

144-
{% details <b>Python script to split a single JSON file with multiple tasks</b> %}
149+
`tasks_with_predictions_and_annotations.json`
150+
```
151+
[
152+
{
153+
"data": {
154+
"image": "s3://bucket/1.jpg",
155+
"text": "opossums are awesome"
156+
},
157+
"annotations": [...],
158+
"predictions": [...]
159+
},
160+
{
161+
"data": {
162+
"image": "s3://bucket/2.jpg",
163+
"text": "cats are awesome"
164+
}
165+
"annotations": [...],
166+
"predictions": [...]
167+
}
168+
]
169+
```
145170

146-
Python script to split a single JSON file containing multiple tasks into separate JSON files, each containing one task:
171+
{% enddetails %}
147172

148-
```python
149-
import sys
150-
import json
173+
<br>
151174

152-
input_json = sys.argv[1]
153-
with open(input_json) as inp:
154-
tasks = json.load(inp)
175+
###### On
155176

156-
for i, v in enumerate(tasks):
157-
with open(f'task_{i}.json', 'w') as f:
158-
json.dump(v, f)
159-
```
177+
When enabled, Label Studio automatically lists files from the storage bucket and constructs tasks. This is only possible for simple labeling tasks that involve a single media source (such as an image, text, etc.).*
160178

161-
{% enddetails %}
179+
<img src="/images/source-storages-treat-on.png" class="make-intense-zoom">
162180

163181

164182
### Target storage

0 commit comments

Comments
 (0)