superb-ai-onprem 0.5.7__py3-none-any.whl → 0.5.8__py3-none-any.whl
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.
Potentially problematic release.
This version of superb-ai-onprem might be problematic. Click here for more details.
- spb_onprem/_version.py +2 -2
- spb_onprem/data/service.py +39 -9
- {superb_ai_onprem-0.5.7.dist-info → superb_ai_onprem-0.5.8.dist-info}/METADATA +1 -1
- {superb_ai_onprem-0.5.7.dist-info → superb_ai_onprem-0.5.8.dist-info}/RECORD +7 -7
- {superb_ai_onprem-0.5.7.dist-info → superb_ai_onprem-0.5.8.dist-info}/WHEEL +0 -0
- {superb_ai_onprem-0.5.7.dist-info → superb_ai_onprem-0.5.8.dist-info}/licenses/LICENSE +0 -0
- {superb_ai_onprem-0.5.7.dist-info → superb_ai_onprem-0.5.8.dist-info}/top_level.txt +0 -0
spb_onprem/_version.py
CHANGED
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '0.5.
|
|
32
|
-
__version_tuple__ = version_tuple = (0, 5,
|
|
31
|
+
__version__ = version = '0.5.8'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 5, 8)
|
|
33
33
|
|
|
34
34
|
__commit_id__ = commit_id = None
|
spb_onprem/data/service.py
CHANGED
|
@@ -177,6 +177,36 @@ class DataService(BaseService):
|
|
|
177
177
|
response.get("totalCount", 0)
|
|
178
178
|
)
|
|
179
179
|
|
|
180
|
+
def _detect_image_type(self, file_data: BytesIO) -> str:
|
|
181
|
+
"""Detect image type from BytesIO data using magic numbers.
|
|
182
|
+
|
|
183
|
+
Args:
|
|
184
|
+
file_data (BytesIO): The image data.
|
|
185
|
+
|
|
186
|
+
Returns:
|
|
187
|
+
str: The MIME type of the image.
|
|
188
|
+
|
|
189
|
+
Raises:
|
|
190
|
+
BadParameterError: If the file format is not a supported image type.
|
|
191
|
+
"""
|
|
192
|
+
current_pos = file_data.tell()
|
|
193
|
+
file_data.seek(0)
|
|
194
|
+
header = file_data.read(12)
|
|
195
|
+
file_data.seek(current_pos)
|
|
196
|
+
|
|
197
|
+
if header.startswith(b'\xff\xd8\xff'):
|
|
198
|
+
return 'image/jpeg'
|
|
199
|
+
elif header.startswith(b'\x89PNG\r\n\x1a\n'):
|
|
200
|
+
return 'image/png'
|
|
201
|
+
elif header.startswith(b'GIF8'):
|
|
202
|
+
return 'image/gif'
|
|
203
|
+
elif header.startswith(b'RIFF') and header[8:12] == b'WEBP':
|
|
204
|
+
return 'image/webp'
|
|
205
|
+
else:
|
|
206
|
+
raise BadParameterError(
|
|
207
|
+
"Unsupported image format. Only JPEG, PNG, GIF, and WebP formats are supported."
|
|
208
|
+
)
|
|
209
|
+
|
|
180
210
|
def create_image_data(
|
|
181
211
|
self,
|
|
182
212
|
dataset_id: str,
|
|
@@ -208,17 +238,17 @@ class DataService(BaseService):
|
|
|
208
238
|
"""
|
|
209
239
|
content_service = ContentService()
|
|
210
240
|
if isinstance(image_content, str):
|
|
211
|
-
with open(image_content, "rb") as f:
|
|
212
|
-
content = content_service.upload_content(
|
|
213
|
-
f.read(),
|
|
214
|
-
key,
|
|
215
|
-
f.name.split(".")[-1]
|
|
216
|
-
)
|
|
217
|
-
else:
|
|
218
241
|
content = content_service.upload_content(
|
|
219
|
-
image_content
|
|
242
|
+
image_content,
|
|
243
|
+
key,
|
|
244
|
+
)
|
|
245
|
+
else:
|
|
246
|
+
# Detect the image type from BytesIO data
|
|
247
|
+
content_type = self._detect_image_type(image_content)
|
|
248
|
+
content = content_service.upload_content_with_data(
|
|
249
|
+
image_content,
|
|
250
|
+
content_type,
|
|
220
251
|
key,
|
|
221
|
-
"jpg"
|
|
222
252
|
)
|
|
223
253
|
|
|
224
254
|
response = self.request_gql(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
spb_onprem/__init__.py,sha256=lGZRdgpRdBFM97SawPJIC-a5uRzrd5jdb9i5yHDeveQ,2649
|
|
2
|
-
spb_onprem/_version.py,sha256=
|
|
2
|
+
spb_onprem/_version.py,sha256=94GfHP_pnw8tNHpsnH9lv-lFOG6x-yD9RalL7Ee8XUA,704
|
|
3
3
|
spb_onprem/base_model.py,sha256=XLtyoxRBs68LrvbFH8V4EvQGPc2W17koC310MnS37jc,442
|
|
4
4
|
spb_onprem/base_service.py,sha256=dPfr3mGXYlqadOXycu6RBFX1HcZ1qzEsskLoOxERLOU,5737
|
|
5
5
|
spb_onprem/base_types.py,sha256=5HO6uy6qf08b4KSElwIaGy7UkoQG2KqVO6gcHbsqqSo,269
|
|
@@ -32,7 +32,7 @@ spb_onprem/contents/params/create.py,sha256=JLMbNiIecOsVvVSYY6DfUpWjZxZKuO9-NSpu
|
|
|
32
32
|
spb_onprem/contents/params/get_download_url.py,sha256=3oaiqmjJRxw0U59SoTxoih1pcU-cuQvcU-g89lCcqtQ,98
|
|
33
33
|
spb_onprem/data/__init__.py,sha256=5XKxNm2BlKufrX5uRQreUEzJ-nerTrozKpG1RJL5wt8,68
|
|
34
34
|
spb_onprem/data/queries.py,sha256=B5vd_8Q8ziwtz44GozbZ-yEN5zKAgMY8wKex-YJJJSs,15607
|
|
35
|
-
spb_onprem/data/service.py,sha256=
|
|
35
|
+
spb_onprem/data/service.py,sha256=Nt6kO64pZVy_pVVmoGgCPl_1cf6-VHb9fsiD7iigiiU,25876
|
|
36
36
|
spb_onprem/data/entities/__init__.py,sha256=ZQ2YWAHIan2ZLa1z5ozPSJwW3pqdlsJCxmAT3NuG89c,376
|
|
37
37
|
spb_onprem/data/entities/annotation.py,sha256=pS97Nx3TWMBrb-iiBfRct4RXl7hPMy2IOzTIpXkmBJU,751
|
|
38
38
|
spb_onprem/data/entities/data.py,sha256=9wD6fk6K-GDaCesWhxA4vW8IyrlG2Tn7xqR1ZB7VN6k,1293
|
|
@@ -108,7 +108,7 @@ spb_onprem/slices/params/update_slice.py,sha256=kryOmCnRTQ_OU0qDKgugppLrpeUpuLwm
|
|
|
108
108
|
spb_onprem/users/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
109
109
|
spb_onprem/users/entities/__init__.py,sha256=X8HZsCTlQnuPszok3AwI-i7bsQi0Ehul5L_2jZaol5E,57
|
|
110
110
|
spb_onprem/users/entities/auth.py,sha256=_KP-7yUErBxhJMm-dE3ObprPEG6e0JI2qNg6g8aK1qM,3371
|
|
111
|
-
superb_ai_onprem-0.5.
|
|
111
|
+
superb_ai_onprem-0.5.8.dist-info/licenses/LICENSE,sha256=CdinbFiHKGkGl6cPde6WgXhMuzyUXEG6tzy2-7udZ8o,1066
|
|
112
112
|
tests/__init__.py,sha256=Nqnn8clbgv-5l0PgxcTOldg8mkMKrFn4TvPL-rYUUGg,1
|
|
113
113
|
tests/activities/__init__.py,sha256=Nqnn8clbgv-5l0PgxcTOldg8mkMKrFn4TvPL-rYUUGg,1
|
|
114
114
|
tests/activities/real_test.py,sha256=0gQHg7rIEuZndGZyNHMWSD5nUZPMsUGigfCjWFxMthQ,1786
|
|
@@ -121,7 +121,7 @@ tests/exports/test_entities.py,sha256=hG7G4kVkyHKT3mv4lvrzUqOW8ILeHiYj87QZjQcmg9
|
|
|
121
121
|
tests/exports/test_integration.py,sha256=cCcEgwIIHyQRlc04EAXSKz7RcblQvhI2GBR3uVaOOq8,6201
|
|
122
122
|
tests/exports/test_params.py,sha256=oRRa6nEru_FImlB3TrmFiBidz6ZstCx4rVaCK-EMGfQ,11070
|
|
123
123
|
tests/exports/test_service.py,sha256=IDcKxrmByh00jk9142P2ThuGureMoijTHNdU0rERGG8,14628
|
|
124
|
-
superb_ai_onprem-0.5.
|
|
125
|
-
superb_ai_onprem-0.5.
|
|
126
|
-
superb_ai_onprem-0.5.
|
|
127
|
-
superb_ai_onprem-0.5.
|
|
124
|
+
superb_ai_onprem-0.5.8.dist-info/METADATA,sha256=uuwPhCI6hNstRsrePMgkC2O3caJVLUeChVb8r6do8sI,5817
|
|
125
|
+
superb_ai_onprem-0.5.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
126
|
+
superb_ai_onprem-0.5.8.dist-info/top_level.txt,sha256=LbqU6FjWKaxO7FPS5-71e3OIS8VgBi5VrtQMWFOW25Q,17
|
|
127
|
+
superb_ai_onprem-0.5.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|