unitlab 2.4.6__tar.gz → 2.5.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {unitlab-2.4.6 → unitlab-2.5.1}/PKG-INFO +1 -9
- {unitlab-2.4.6 → unitlab-2.5.1}/README.md +0 -8
- {unitlab-2.4.6 → unitlab-2.5.1}/pyproject.toml +1 -1
- {unitlab-2.4.6 → unitlab-2.5.1}/src/unitlab/cli.py +0 -10
- {unitlab-2.4.6 → unitlab-2.5.1}/src/unitlab/client.py +10 -17
- {unitlab-2.4.6 → unitlab-2.5.1}/.claude/settings.local.json +0 -0
- {unitlab-2.4.6 → unitlab-2.5.1}/.gitignore +0 -0
- {unitlab-2.4.6 → unitlab-2.5.1}/LICENSE.md +0 -0
- {unitlab-2.4.6 → unitlab-2.5.1}/src/unitlab/__init__.py +0 -0
- {unitlab-2.4.6 → unitlab-2.5.1}/src/unitlab/__main__.py +0 -0
- {unitlab-2.4.6 → unitlab-2.5.1}/src/unitlab/_config.py +0 -0
- {unitlab-2.4.6 → unitlab-2.5.1}/src/unitlab/exceptions.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: unitlab
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.5.1
|
|
4
4
|
Summary: Python SDK for the Unitlab.ai data annotation platform
|
|
5
5
|
Project-URL: Homepage, https://unitlab.ai
|
|
6
6
|
Project-URL: Documentation, https://docs.unitlab.ai
|
|
@@ -121,8 +121,6 @@ projects = client.projects()
|
|
|
121
121
|
# Get project details
|
|
122
122
|
project = client.project("PROJECT_ID")
|
|
123
123
|
|
|
124
|
-
# Get project members
|
|
125
|
-
members = client.project_members("PROJECT_ID")
|
|
126
124
|
```
|
|
127
125
|
|
|
128
126
|
### Upload data
|
|
@@ -141,9 +139,6 @@ the supported extensions: images, text, video, audio, medical
|
|
|
141
139
|
Additional options for specific file types:
|
|
142
140
|
|
|
143
141
|
```python
|
|
144
|
-
# Text files
|
|
145
|
-
client.project_upload_data("PROJECT_ID", "./docs", sentences_per_chunk=10)
|
|
146
|
-
|
|
147
142
|
# Video files
|
|
148
143
|
client.project_upload_data("PROJECT_ID", "./videos", fps=30.0)
|
|
149
144
|
|
|
@@ -181,9 +176,6 @@ unitlab project list
|
|
|
181
176
|
# Project details
|
|
182
177
|
unitlab project detail PROJECT_ID
|
|
183
178
|
|
|
184
|
-
# Project members
|
|
185
|
-
unitlab project members PROJECT_ID
|
|
186
|
-
|
|
187
179
|
# Upload data to a project
|
|
188
180
|
unitlab project upload PROJECT_ID --directory ./images
|
|
189
181
|
|
|
@@ -87,8 +87,6 @@ projects = client.projects()
|
|
|
87
87
|
# Get project details
|
|
88
88
|
project = client.project("PROJECT_ID")
|
|
89
89
|
|
|
90
|
-
# Get project members
|
|
91
|
-
members = client.project_members("PROJECT_ID")
|
|
92
90
|
```
|
|
93
91
|
|
|
94
92
|
### Upload data
|
|
@@ -107,9 +105,6 @@ the supported extensions: images, text, video, audio, medical
|
|
|
107
105
|
Additional options for specific file types:
|
|
108
106
|
|
|
109
107
|
```python
|
|
110
|
-
# Text files
|
|
111
|
-
client.project_upload_data("PROJECT_ID", "./docs", sentences_per_chunk=10)
|
|
112
|
-
|
|
113
108
|
# Video files
|
|
114
109
|
client.project_upload_data("PROJECT_ID", "./videos", fps=30.0)
|
|
115
110
|
|
|
@@ -147,9 +142,6 @@ unitlab project list
|
|
|
147
142
|
# Project details
|
|
148
143
|
unitlab project detail PROJECT_ID
|
|
149
144
|
|
|
150
|
-
# Project members
|
|
151
|
-
unitlab project members PROJECT_ID
|
|
152
|
-
|
|
153
145
|
# Upload data to a project
|
|
154
146
|
unitlab project upload PROJECT_ID --directory ./images
|
|
155
147
|
|
|
@@ -72,11 +72,6 @@ def project_detail(pk: UUID, api_key: API_KEY = None):
|
|
|
72
72
|
typer.echo(get_client(api_key).project(project_id=pk, pretty=1))
|
|
73
73
|
|
|
74
74
|
|
|
75
|
-
@project_app.command(help="Project members")
|
|
76
|
-
def members(pk: UUID, api_key: API_KEY = None):
|
|
77
|
-
typer.echo(get_client(api_key).project_members(project_id=pk, pretty=1))
|
|
78
|
-
|
|
79
|
-
|
|
80
75
|
@project_app.command(help="Upload data")
|
|
81
76
|
def upload(
|
|
82
77
|
pk: UUID,
|
|
@@ -84,10 +79,6 @@ def upload(
|
|
|
84
79
|
Path, typer.Option(help="Directory containing the data to be uploaded")
|
|
85
80
|
],
|
|
86
81
|
api_key: API_KEY = None,
|
|
87
|
-
sentences_per_chunk: Annotated[
|
|
88
|
-
int,
|
|
89
|
-
typer.Option(help="Sentences per chunk for text projects"),
|
|
90
|
-
] = 10,
|
|
91
82
|
fps: Annotated[
|
|
92
83
|
float,
|
|
93
84
|
typer.Option(
|
|
@@ -98,7 +89,6 @@ def upload(
|
|
|
98
89
|
result = get_client(api_key).project_upload_data(
|
|
99
90
|
str(pk),
|
|
100
91
|
directory=directory,
|
|
101
|
-
sentences_per_chunk=sentences_per_chunk,
|
|
102
92
|
fps=fps,
|
|
103
93
|
)
|
|
104
94
|
typer.echo(f"Uploaded {result['uploaded']} of {result['total']} files")
|
|
@@ -197,9 +197,6 @@ class UnitlabClient:
|
|
|
197
197
|
def project(self, project_id: str, pretty: int = 0) -> Any:
|
|
198
198
|
return self._get(f"/api/sdk/projects/{project_id}/?pretty={pretty}")
|
|
199
199
|
|
|
200
|
-
def project_members(self, project_id: str, pretty: int = 0) -> Any:
|
|
201
|
-
return self._get(f"/api/sdk/projects/{project_id}/members/?pretty={pretty}")
|
|
202
|
-
|
|
203
200
|
def project_upload_info(self, project_id: str) -> Any:
|
|
204
201
|
return self._get(f"/api/sdk/projects/{project_id}/upload-info/")
|
|
205
202
|
|
|
@@ -248,8 +245,7 @@ class UnitlabClient:
|
|
|
248
245
|
project_id: str,
|
|
249
246
|
directory: str | Path,
|
|
250
247
|
batch_size: int = 100,
|
|
251
|
-
|
|
252
|
-
fps: float = 1.0,
|
|
248
|
+
fps: float = 1.0, # Applies only to video files.
|
|
253
249
|
) -> dict[str, int]:
|
|
254
250
|
directory = str(directory)
|
|
255
251
|
if not os.path.isdir(directory):
|
|
@@ -317,9 +313,9 @@ class UnitlabClient:
|
|
|
317
313
|
num_batches = (num_files + batch_size - 1) // batch_size
|
|
318
314
|
semaphore = asyncio.Semaphore(_UPLOAD_CONCURRENCY)
|
|
319
315
|
|
|
320
|
-
#
|
|
321
|
-
#
|
|
322
|
-
|
|
316
|
+
# Files in the same upload run share one project upload session. Medical
|
|
317
|
+
# finalization uses the same id for its series-level grouping.
|
|
318
|
+
upload_session_id = str(uuid.uuid4())
|
|
323
319
|
|
|
324
320
|
# Finalization is only relevant when this batch includes medical files.
|
|
325
321
|
has_medical_files = any(
|
|
@@ -338,12 +334,9 @@ class UnitlabClient:
|
|
|
338
334
|
or project_generic_type
|
|
339
335
|
)
|
|
340
336
|
extra_data: dict[str, str] = {}
|
|
341
|
-
if file_generic_type == "
|
|
342
|
-
extra_data["sentences_per_chunk"] = str(sentences_per_chunk)
|
|
343
|
-
elif file_generic_type == "video":
|
|
337
|
+
if file_generic_type == "video":
|
|
344
338
|
extra_data["fps"] = str(fps)
|
|
345
|
-
|
|
346
|
-
extra_data["session_id"] = medical_session_id
|
|
339
|
+
extra_data["session_id"] = upload_session_id
|
|
347
340
|
|
|
348
341
|
try:
|
|
349
342
|
with open(file, "rb") as f:
|
|
@@ -404,7 +397,7 @@ class UnitlabClient:
|
|
|
404
397
|
try:
|
|
405
398
|
response = await client.post(
|
|
406
399
|
f"/api/sdk/projects/{project_id}/"
|
|
407
|
-
f"medical-upload-sessions/{
|
|
400
|
+
f"medical-upload-sessions/{upload_session_id}/finalize/",
|
|
408
401
|
)
|
|
409
402
|
response.raise_for_status()
|
|
410
403
|
logger.info("Medical session finalized")
|
|
@@ -442,7 +435,7 @@ class UnitlabClient:
|
|
|
442
435
|
return asyncio.run(main())
|
|
443
436
|
|
|
444
437
|
def datasets(self, pretty: int = 0) -> Any:
|
|
445
|
-
return self._get(f"/api/sdk/
|
|
438
|
+
return self._get(f"/api/sdk/releases/?pretty={pretty}")
|
|
446
439
|
|
|
447
440
|
def dataset_download(
|
|
448
441
|
self,
|
|
@@ -456,7 +449,7 @@ class UnitlabClient:
|
|
|
456
449
|
if split_type is not None:
|
|
457
450
|
data["split_type"] = split_type
|
|
458
451
|
|
|
459
|
-
response = self._post(f"/api/sdk/
|
|
452
|
+
response = self._post(f"/api/sdk/releases/{dataset_id}/", data=data)
|
|
460
453
|
|
|
461
454
|
file_url = response["file"]
|
|
462
455
|
try:
|
|
@@ -484,7 +477,7 @@ class UnitlabClient:
|
|
|
484
477
|
Path to the download folder.
|
|
485
478
|
"""
|
|
486
479
|
response = self._post(
|
|
487
|
-
f"/api/sdk/
|
|
480
|
+
f"/api/sdk/releases/{dataset_id}/", data={"download_type": "files"}
|
|
488
481
|
)
|
|
489
482
|
base_folder = str(dataset_id)
|
|
490
483
|
os.makedirs(base_folder, exist_ok=True)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|