unitlab 2.4.2__tar.gz → 2.4.3__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.2 → unitlab-2.4.3}/.claude/settings.local.json +3 -1
- {unitlab-2.4.2 → unitlab-2.4.3}/PKG-INFO +1 -1
- {unitlab-2.4.2 → unitlab-2.4.3}/pyproject.toml +1 -1
- {unitlab-2.4.2 → unitlab-2.4.3}/src/unitlab/client.py +15 -0
- {unitlab-2.4.2 → unitlab-2.4.3}/.gitignore +0 -0
- {unitlab-2.4.2 → unitlab-2.4.3}/LICENSE.md +0 -0
- {unitlab-2.4.2 → unitlab-2.4.3}/README.md +0 -0
- {unitlab-2.4.2 → unitlab-2.4.3}/src/unitlab/__init__.py +0 -0
- {unitlab-2.4.2 → unitlab-2.4.3}/src/unitlab/__main__.py +0 -0
- {unitlab-2.4.2 → unitlab-2.4.3}/src/unitlab/_config.py +0 -0
- {unitlab-2.4.2 → unitlab-2.4.3}/src/unitlab/cli.py +0 -0
- {unitlab-2.4.2 → unitlab-2.4.3}/src/unitlab/exceptions.py +0 -0
|
@@ -41,7 +41,9 @@
|
|
|
41
41
|
"Bash(ps:*)",
|
|
42
42
|
"WebFetch(domain:127.0.0.1)",
|
|
43
43
|
"Bash(DATASET_ID=\"b727a6fd-7786-4d40-b75b-56e7f52f378b\")",
|
|
44
|
-
"Bash(pipenv run:*)"
|
|
44
|
+
"Bash(pipenv run:*)",
|
|
45
|
+
"Bash(DS=\"b727a6fd-7786-4d40-b75b-56e7f52f378b\")",
|
|
46
|
+
"Bash(python3 -c \"import sys,json; d=json.load\\(sys.stdin\\); print\\(''''OK'''' if ''''file'''' in d else d\\)\")"
|
|
45
47
|
]
|
|
46
48
|
}
|
|
47
49
|
}
|
|
@@ -4,6 +4,7 @@ import asyncio
|
|
|
4
4
|
import functools
|
|
5
5
|
import logging
|
|
6
6
|
import os
|
|
7
|
+
import uuid
|
|
7
8
|
from pathlib import Path
|
|
8
9
|
from typing import Any
|
|
9
10
|
from urllib.parse import urlparse
|
|
@@ -247,6 +248,9 @@ class UnitlabClient:
|
|
|
247
248
|
num_batches = (num_files + batch_size - 1) // batch_size
|
|
248
249
|
semaphore = asyncio.Semaphore(_UPLOAD_CONCURRENCY)
|
|
249
250
|
|
|
251
|
+
# Medical projects use session-based upload with finalize
|
|
252
|
+
session_id = str(uuid.uuid4()) if generic_type == "medical" else None
|
|
253
|
+
|
|
250
254
|
async def post_file(
|
|
251
255
|
client: httpx.AsyncClient, file: str, project_id: str
|
|
252
256
|
) -> int:
|
|
@@ -256,6 +260,8 @@ class UnitlabClient:
|
|
|
256
260
|
extra_data["sentences_per_chunk"] = str(sentences_per_chunk)
|
|
257
261
|
elif generic_type == "video":
|
|
258
262
|
extra_data["fps"] = str(fps)
|
|
263
|
+
if session_id:
|
|
264
|
+
extra_data["session_id"] = session_id
|
|
259
265
|
|
|
260
266
|
try:
|
|
261
267
|
with open(file, "rb") as f:
|
|
@@ -288,6 +294,15 @@ class UnitlabClient:
|
|
|
288
294
|
for f in asyncio.as_completed(tasks):
|
|
289
295
|
pbar.update(await f)
|
|
290
296
|
|
|
297
|
+
# Finalize medical session after all uploads
|
|
298
|
+
if session_id:
|
|
299
|
+
response = await client.post(
|
|
300
|
+
f"/api/sdk/projects/{project_id}/"
|
|
301
|
+
f"medical-upload-sessions/{session_id}/finalize/",
|
|
302
|
+
)
|
|
303
|
+
response.raise_for_status()
|
|
304
|
+
logger.info("Medical session finalized")
|
|
305
|
+
|
|
291
306
|
asyncio.run(main())
|
|
292
307
|
|
|
293
308
|
def datasets(self, pretty: int = 0) -> Any:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|