labeltify 0.2.0__tar.gz → 0.3.0__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.
- {labeltify-0.2.0 → labeltify-0.3.0}/PKG-INFO +2 -2
- {labeltify-0.2.0 → labeltify-0.3.0}/README.md +1 -1
- {labeltify-0.2.0 → labeltify-0.3.0}/labeltify/client.py +7 -1
- {labeltify-0.2.0 → labeltify-0.3.0}/labeltify.egg-info/PKG-INFO +2 -2
- {labeltify-0.2.0 → labeltify-0.3.0}/pyproject.toml +1 -1
- {labeltify-0.2.0 → labeltify-0.3.0}/tests/test_client.py +10 -0
- {labeltify-0.2.0 → labeltify-0.3.0}/labeltify/__init__.py +0 -0
- {labeltify-0.2.0 → labeltify-0.3.0}/labeltify.egg-info/SOURCES.txt +0 -0
- {labeltify-0.2.0 → labeltify-0.3.0}/labeltify.egg-info/dependency_links.txt +0 -0
- {labeltify-0.2.0 → labeltify-0.3.0}/labeltify.egg-info/requires.txt +0 -0
- {labeltify-0.2.0 → labeltify-0.3.0}/labeltify.egg-info/top_level.txt +0 -0
- {labeltify-0.2.0 → labeltify-0.3.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: labeltify
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Upload frames and optional annotations into LabelTify with a pipeline token.
|
|
5
5
|
Author: CleverTify
|
|
6
6
|
Project-URL: Homepage, https://labeltify.com
|
|
@@ -46,7 +46,7 @@ client.upload_file("DATASET_ID", "frames/cam02.jpg", camera="cam-02")
|
|
|
46
46
|
|
|
47
47
|
The token knows its org, so you don't pass one. Timeouts, `429`, and `5xx` responses are retried with exponential backoff (`max_retries=4` by default). Anything else raises `LabelTifyError` with the API's message and `.status`.
|
|
48
48
|
|
|
49
|
-
Annotations are optional.
|
|
49
|
+
Annotations are optional. When you pass `labels` (COCO, LabelTify, or YOLO JSON bytes), `work_state` is required: `done`, `in_progress`, `unsure`, or `untouched`. There is no default; the client raises `LabelTifyError` before sending if it is missing. Images with no labels stay untouched.
|
|
50
50
|
|
|
51
51
|
Send model proposals to the Loop review queue:
|
|
52
52
|
|
|
@@ -27,7 +27,7 @@ client.upload_file("DATASET_ID", "frames/cam02.jpg", camera="cam-02")
|
|
|
27
27
|
|
|
28
28
|
The token knows its org, so you don't pass one. Timeouts, `429`, and `5xx` responses are retried with exponential backoff (`max_retries=4` by default). Anything else raises `LabelTifyError` with the API's message and `.status`.
|
|
29
29
|
|
|
30
|
-
Annotations are optional.
|
|
30
|
+
Annotations are optional. When you pass `labels` (COCO, LabelTify, or YOLO JSON bytes), `work_state` is required: `done`, `in_progress`, `unsure`, or `untouched`. There is no default; the client raises `LabelTifyError` before sending if it is missing. Images with no labels stay untouched.
|
|
31
31
|
|
|
32
32
|
Send model proposals to the Loop review queue:
|
|
33
33
|
|
|
@@ -23,6 +23,7 @@ from pathlib import Path
|
|
|
23
23
|
from typing import Any
|
|
24
24
|
|
|
25
25
|
DEFAULT_BASE_URL = "https://api.labeltify.com"
|
|
26
|
+
WORK_STATES = ("done", "in_progress", "unsure", "untouched")
|
|
26
27
|
RETRY_STATUS = {408, 425, 429, 500, 502, 503, 504}
|
|
27
28
|
|
|
28
29
|
|
|
@@ -122,7 +123,12 @@ class LabelTifyClient:
|
|
|
122
123
|
labels_filename: str = "labels.json",
|
|
123
124
|
work_state: str | None = None,
|
|
124
125
|
) -> dict[str, Any]:
|
|
125
|
-
"""Upload one image. ``labels`` is optional COCO, LabelTify, or YOLO JSON for it.
|
|
126
|
+
"""Upload one image. ``labels`` is optional COCO, LabelTify, or YOLO JSON for it.
|
|
127
|
+
|
|
128
|
+
With ``labels``, ``work_state`` is required: done, in_progress, unsure, or untouched.
|
|
129
|
+
"""
|
|
130
|
+
if labels is not None and work_state not in WORK_STATES:
|
|
131
|
+
raise LabelTifyError(f"work_state is required with labels: one of {', '.join(WORK_STATES)}")
|
|
126
132
|
boundary = f"----labeltify{uuid.uuid4().hex}"
|
|
127
133
|
parts: list[bytes] = []
|
|
128
134
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: labeltify
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Upload frames and optional annotations into LabelTify with a pipeline token.
|
|
5
5
|
Author: CleverTify
|
|
6
6
|
Project-URL: Homepage, https://labeltify.com
|
|
@@ -46,7 +46,7 @@ client.upload_file("DATASET_ID", "frames/cam02.jpg", camera="cam-02")
|
|
|
46
46
|
|
|
47
47
|
The token knows its org, so you don't pass one. Timeouts, `429`, and `5xx` responses are retried with exponential backoff (`max_retries=4` by default). Anything else raises `LabelTifyError` with the API's message and `.status`.
|
|
48
48
|
|
|
49
|
-
Annotations are optional.
|
|
49
|
+
Annotations are optional. When you pass `labels` (COCO, LabelTify, or YOLO JSON bytes), `work_state` is required: `done`, `in_progress`, `unsure`, or `untouched`. There is no default; the client raises `LabelTifyError` before sending if it is missing. Images with no labels stay untouched.
|
|
50
50
|
|
|
51
51
|
Send model proposals to the Loop review queue:
|
|
52
52
|
|
|
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "labeltify"
|
|
7
7
|
# Bump this to publish. .github/workflows/publish-python.yml releases each new version pushed to main.
|
|
8
|
-
version = "0.
|
|
8
|
+
version = "0.3.0"
|
|
9
9
|
description = "Upload frames and optional annotations into LabelTify with a pipeline token."
|
|
10
10
|
readme = "README.md"
|
|
11
11
|
requires-python = ">=3.10"
|
|
@@ -125,3 +125,13 @@ def test_propose(api):
|
|
|
125
125
|
task = client.propose("ds-1", "img-1", [{"classId": "car"}], model_ref="deepstream@1")
|
|
126
126
|
assert task["echo"]["modelRef"] == "deepstream@1"
|
|
127
127
|
assert api.requests[-1][1] == "/api/orgs/acme/datasets/ds-1/al/tasks"
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def test_labels_need_a_work_state(api):
|
|
131
|
+
client = LabelTifyClient("labeltify_test", base_url=api.url, org="acme", backoff=0)
|
|
132
|
+
before = len(api.requests)
|
|
133
|
+
with pytest.raises(LabelTifyError, match="work_state is required"):
|
|
134
|
+
client.upload_image("ds-1", b"x", "a.jpg", labels=b'{"images": []}')
|
|
135
|
+
with pytest.raises(LabelTifyError, match="work_state is required"):
|
|
136
|
+
client.upload_image("ds-1", b"x", "a.jpg", labels=b'{"images": []}', work_state="skipped")
|
|
137
|
+
assert len(api.requests) == before
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|