dragoneye-python 0.4.1__tar.gz → 0.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.
Files changed (21) hide show
  1. {dragoneye_python-0.4.1 → dragoneye_python-0.5.1}/PKG-INFO +1 -1
  2. {dragoneye_python-0.4.1 → dragoneye_python-0.5.1}/dragoneye_python.egg-info/PKG-INFO +1 -1
  3. {dragoneye_python-0.4.1 → dragoneye_python-0.5.1}/pyproject.toml +1 -1
  4. dragoneye_python-0.5.1/src/dragoneye/__init__.py +32 -0
  5. {dragoneye_python-0.4.1 → dragoneye_python-0.5.1}/src/dragoneye/classification.py +2 -1
  6. {dragoneye_python-0.4.1 → dragoneye_python-0.5.1}/src/dragoneye/models.py +26 -11
  7. dragoneye_python-0.5.1/src/dragoneye/types/common.py +12 -0
  8. {dragoneye_python-0.4.1 → dragoneye_python-0.5.1}/src/dragoneye/types/media.py +4 -4
  9. dragoneye_python-0.4.1/src/dragoneye/__init__.py +0 -25
  10. dragoneye_python-0.4.1/src/dragoneye/types/common.py +0 -31
  11. {dragoneye_python-0.4.1 → dragoneye_python-0.5.1}/README.md +0 -0
  12. {dragoneye_python-0.4.1 → dragoneye_python-0.5.1}/dragoneye_python.egg-info/SOURCES.txt +0 -0
  13. {dragoneye_python-0.4.1 → dragoneye_python-0.5.1}/dragoneye_python.egg-info/dependency_links.txt +0 -0
  14. {dragoneye_python-0.4.1 → dragoneye_python-0.5.1}/dragoneye_python.egg-info/requires.txt +0 -0
  15. {dragoneye_python-0.4.1 → dragoneye_python-0.5.1}/dragoneye_python.egg-info/top_level.txt +0 -0
  16. {dragoneye_python-0.4.1 → dragoneye_python-0.5.1}/requirements.txt +0 -0
  17. {dragoneye_python-0.4.1 → dragoneye_python-0.5.1}/setup.cfg +0 -0
  18. {dragoneye_python-0.4.1 → dragoneye_python-0.5.1}/src/dragoneye/client.py +0 -0
  19. {dragoneye_python-0.4.1 → dragoneye_python-0.5.1}/src/dragoneye/constants.py +0 -0
  20. {dragoneye_python-0.4.1 → dragoneye_python-0.5.1}/src/dragoneye/types/__init__.py +0 -0
  21. {dragoneye_python-0.4.1 → dragoneye_python-0.5.1}/src/dragoneye/types/exception.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dragoneye-python
3
- Version: 0.4.1
3
+ Version: 0.5.1
4
4
  License-Expression: MIT
5
5
  Requires-Python: >=3.8
6
6
  Requires-Dist: requests
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dragoneye-python
3
- Version: 0.4.1
3
+ Version: 0.5.1
4
4
  License-Expression: MIT
5
5
  Requires-Python: >=3.8
6
6
  Requires-Dist: requests
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "dragoneye-python"
7
- version = "0.4.1"
7
+ version = "0.5.1"
8
8
  requires-python = ">=3.8"
9
9
  dynamic = ["dependencies"]
10
10
  license = "MIT"
@@ -0,0 +1,32 @@
1
+ from .classification import (
2
+ Classification,
3
+ )
4
+ from .client import Dragoneye
5
+ from .models import (
6
+ ClassificationAttributeOption,
7
+ ClassificationAttributeResponse,
8
+ ClassificationCategory,
9
+ ClassificationCategoryPrediction,
10
+ ClassificationObjectPrediction,
11
+ ClassificationPredictImageResponse,
12
+ ClassificationPredictVideoResponse,
13
+ ClassificationVideoObjectPrediction,
14
+ )
15
+ from .types.common import NormalizedBbox
16
+ from .types.media import Image, Video
17
+
18
+ __all__ = [
19
+ "Classification",
20
+ "ClassificationAttributeOption",
21
+ "ClassificationAttributeResponse",
22
+ "ClassificationCategory",
23
+ "ClassificationCategoryPrediction",
24
+ "ClassificationObjectPrediction",
25
+ "ClassificationPredictImageResponse",
26
+ "ClassificationPredictVideoResponse",
27
+ "ClassificationVideoObjectPrediction",
28
+ "Dragoneye",
29
+ "Image",
30
+ "NormalizedBbox",
31
+ "Video",
32
+ ]
@@ -255,7 +255,7 @@ class Classification:
255
255
  )
256
256
 
257
257
  predict_url = f"{BASE_API_URL}/predict"
258
- predict_data = {
258
+ predict_data: dict[str, Any] = {
259
259
  "model_name": model_name,
260
260
  "prediction_task_uuid": prediction_task_begin_response.prediction_task_uuid,
261
261
  **kwargs,
@@ -354,6 +354,7 @@ class Classification:
354
354
 
355
355
  form_data = aiohttp.FormData()
356
356
  form_data.add_field("mimetype", mime_type)
357
+ form_data.add_field("response_version", "object")
357
358
  if file_name is not None:
358
359
  form_data.add_field("file_name", file_name)
359
360
 
@@ -1,4 +1,4 @@
1
- from typing import Dict, Sequence
1
+ from typing import Dict, List, Optional
2
2
 
3
3
  from pydantic import BaseModel
4
4
 
@@ -7,8 +7,6 @@ from dragoneye.types.common import (
7
7
  PredictionTaskState,
8
8
  PredictionTaskUUID,
9
9
  PredictionType,
10
- TaxonID,
11
- TaxonPrediction,
12
10
  )
13
11
 
14
12
 
@@ -18,22 +16,38 @@ class PredictionTaskStatusResponse(BaseModel):
18
16
  status: PredictionTaskState
19
17
 
20
18
 
21
- class ClassificationTraitRootPrediction(BaseModel):
22
- id: TaxonID
19
+ class ClassificationAttributeOption(BaseModel):
20
+ option_id: int
23
21
  name: str
24
- displayName: str
25
- taxons: Sequence[TaxonPrediction]
22
+ score: float
23
+
24
+
25
+ class ClassificationAttributeResponse(BaseModel):
26
+ attribute_id: int
27
+ name: str
28
+ options: List[ClassificationAttributeOption]
29
+
30
+
31
+ class ClassificationCategory(BaseModel):
32
+ id: int
33
+ name: str
34
+ score: float
35
+
36
+
37
+ class ClassificationCategoryPrediction(BaseModel):
38
+ category: ClassificationCategory
39
+ attributes: List[ClassificationAttributeResponse]
26
40
 
27
41
 
28
42
  class ClassificationObjectPrediction(BaseModel):
29
43
  normalizedBbox: NormalizedBbox
30
- category: TaxonPrediction
31
- traits: Sequence[ClassificationTraitRootPrediction]
44
+ predictions: List[ClassificationCategoryPrediction]
32
45
 
33
46
 
34
47
  class ClassificationPredictImageResponse(BaseModel):
35
- predictions: Sequence[ClassificationObjectPrediction]
48
+ object_predictions: List[ClassificationObjectPrediction]
36
49
  prediction_task_uuid: PredictionTaskUUID
50
+ original_file_name: Optional[str]
37
51
 
38
52
 
39
53
  class ClassificationVideoObjectPrediction(ClassificationObjectPrediction):
@@ -43,7 +57,8 @@ class ClassificationVideoObjectPrediction(ClassificationObjectPrediction):
43
57
 
44
58
  class ClassificationPredictVideoResponse(BaseModel):
45
59
  timestamp_us_to_predictions: Dict[
46
- int, Sequence[ClassificationVideoObjectPrediction]
60
+ int, List[ClassificationVideoObjectPrediction]
47
61
  ]
48
62
  frames_per_second: int
49
63
  prediction_task_uuid: PredictionTaskUUID
64
+ original_file_name: Optional[str]
@@ -0,0 +1,12 @@
1
+ from typing import Literal, NewType, Tuple
2
+
3
+ PredictionType = Literal["image", "video"]
4
+ PredictionTaskState = NewType("PredictionTaskState", str)
5
+
6
+ NormalizedBbox = NewType("NormalizedBbox", Tuple[float, float, float, float])
7
+
8
+ PredictionTaskUUID = NewType("PredictionTaskUUID", str)
9
+
10
+ TimestampUs = NewType("TimestampUs", int)
11
+
12
+ BASE_API_URL = "https://api.dragoneye.ai"
@@ -136,10 +136,10 @@ class Media:
136
136
 
137
137
  # For any readable object with .read()
138
138
  if hasattr(src, "read"):
139
- pos = _tell_safe(src)
140
- data = src.read()
141
- _seek_safe(src, pos)
142
- return BytesIO(data)
139
+ pos = _tell_safe(src) # pyright: ignore [reportArgumentType]
140
+ data = src.read() # pyright: ignore [reportUnknownMemberType, reportAttributeAccessIssue, reportUnknownVariableType]
141
+ _seek_safe(src, pos) # pyright: ignore [reportArgumentType]
142
+ return BytesIO(data) # pyright: ignore [reportUnknownArgumentType]
143
143
 
144
144
  raise TypeError(
145
145
  "Invalid media source: expected bytes, BytesIO, or a readable binary stream."
@@ -1,25 +0,0 @@
1
- from .classification import (
2
- Classification,
3
- )
4
- from .client import Dragoneye
5
- from .models import (
6
- ClassificationObjectPrediction,
7
- ClassificationPredictImageResponse,
8
- ClassificationTraitRootPrediction,
9
- )
10
- from .types.common import NormalizedBbox, TaxonID, TaxonPrediction, TaxonType
11
- from .types.media import Image, Video
12
-
13
- __all__ = [
14
- "Classification",
15
- "ClassificationObjectPrediction",
16
- "ClassificationPredictImageResponse",
17
- "ClassificationTraitRootPrediction",
18
- "Dragoneye",
19
- "Image",
20
- "Video",
21
- "NormalizedBbox",
22
- "TaxonID",
23
- "TaxonPrediction",
24
- "TaxonType",
25
- ]
@@ -1,31 +0,0 @@
1
- from enum import Enum
2
- from typing import Literal, NewType, Optional, Sequence, Tuple
3
-
4
- from pydantic import BaseModel
5
-
6
- PredictionType = Literal["image", "video"]
7
- PredictionTaskState = NewType("PredictionTaskState", str)
8
-
9
- NormalizedBbox = NewType("NormalizedBbox", Tuple[float, float, float, float])
10
-
11
-
12
- class TaxonType(str, Enum):
13
- CATEGORY = ("category",)
14
- TRAIT = ("trait",)
15
-
16
-
17
- TaxonID = NewType("TaxonID", int)
18
-
19
- PredictionTaskUUID = NewType("PredictionTaskUUID", str)
20
-
21
-
22
- class TaxonPrediction(BaseModel):
23
- id: TaxonID
24
- type: TaxonType
25
- name: str
26
- displayName: str
27
- score: Optional[float]
28
- children: Sequence["TaxonPrediction"]
29
-
30
-
31
- BASE_API_URL = "https://api.dragoneye.ai"