superannotate 4.4.23b1__tar.gz → 4.4.24.dev2__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.
- {superannotate-4.4.23b1/src/superannotate.egg-info → superannotate-4.4.24.dev2}/PKG-INFO +1 -1
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/__init__.py +1 -1
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/helpers.py +44 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/interface/sdk_interface.py +100 -51
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/entities/__init__.py +2 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/entities/project.py +23 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/reporter.py +1 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/serviceproviders.py +22 -2
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/usecases/annotations.py +5 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/usecases/items.py +245 -5
- superannotate-4.4.24.dev2/src/superannotate/lib/core/utils.py +4 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/infrastructure/controller.py +20 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/infrastructure/services/annotation.py +3 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/infrastructure/services/item.py +1 -2
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/infrastructure/services/project.py +76 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2/src/superannotate.egg-info}/PKG-INFO +1 -1
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate.egg-info/SOURCES.txt +1 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/LICENSE +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/MANIFEST.in +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/README.rst +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/requirements.txt +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/setup.cfg +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/setup.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/__init__.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/__init__.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/analytics/__init__.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/analytics/aggregators.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/analytics/common.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/bin/__init__.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/bin/superannotate.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/common.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/exceptions.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/__init__.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/conversion.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/__init__.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/baseStrategy.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/coco_converters/__init__.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/coco_converters/coco_api.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/coco_converters/coco_converter.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/coco_converters/coco_strategies.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/coco_converters/coco_to_sa_pixel.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/coco_converters/coco_to_sa_vector.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/coco_converters/sa_pixel_to_coco.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/coco_converters/sa_vector_to_coco.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/converters.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/dataloop_converters/__init__.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/dataloop_converters/dataloop_helper.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/dataloop_converters/dataloop_strategies.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/dataloop_converters/dataloop_to_sa_vector.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/googlecloud_converters/__init__.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/googlecloud_converters/googlecloud_strategies.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/googlecloud_converters/googlecloud_to_sa_vector.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/labelbox_converters/__init__.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/labelbox_converters/labelbox_helper.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/labelbox_converters/labelbox_strategies.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/labelbox_converters/labelbox_to_sa_pixel.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/labelbox_converters/labelbox_to_sa_vector.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/sa_json_helper.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/sagemaker_converters/__init__.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/sagemaker_converters/sagemaker_strategies.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/sagemaker_converters/sagemaker_to_sa_pixel.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/sagemaker_converters/sagemaker_to_sa_vector.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/supervisely_converters/__init__.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/supervisely_converters/supervisely_helper.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/supervisely_converters/supervisely_strategies.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/supervisely_converters/supervisely_to_sa_pixel.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/supervisely_converters/supervisely_to_sa_vector.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/vgg_converters/__init__.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/vgg_converters/vgg_helper.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/vgg_converters/vgg_strategies.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/vgg_converters/vgg_to_sa_vector.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/voc_converters/__init__.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/voc_converters/voc_helper.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/voc_converters/voc_strategies.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/voc_converters/voc_to_sa_pixel.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/voc_converters/voc_to_sa_vector.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/vott_converters/__init__.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/vott_converters/vott_strategies.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/vott_converters/vott_to_sa_vector.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/yolo_converters/__init__.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/yolo_converters/yolo_strategies.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/converters/yolo_converters/yolo_to_sa_vector.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/export_from_sa_conversions.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/import_to_sa_conversions.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/input_converters/sa_conversion.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/interface/__init__.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/interface/base_interface.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/interface/cli_interface.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/interface/sdk/__init__.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/interface/sdk/folders.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/interface/sdk/project.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/interface/types.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/app/serializers.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/__init__.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/base_usecases.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/conditions.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/config.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/entities/base.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/entities/classes.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/entities/folder.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/entities/integrations.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/entities/items.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/entities/project_entities.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/enums.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/exceptions.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/plugin.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/pydantic_v1.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/repositories.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/response.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/service_types.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/types.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/usecases/__init__.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/usecases/base.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/usecases/classes.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/usecases/custom_fields.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/usecases/folders.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/usecases/images.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/usecases/integrations.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/usecases/models.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/usecases/projects.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/video_convertor.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/infrastructure/__init__.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/infrastructure/helpers.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/infrastructure/repositories.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/infrastructure/serviceprovider.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/infrastructure/services/__init__.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/infrastructure/services/annotation_class.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/infrastructure/services/custom_field.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/infrastructure/services/folder.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/infrastructure/services/http_client.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/infrastructure/services/integration.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/infrastructure/services/models.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/infrastructure/services/subset.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/infrastructure/stream_data_handler.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/infrastructure/utils.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/infrastructure/validators.py +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate.egg-info/dependency_links.txt +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate.egg-info/entry_points.txt +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate.egg-info/requires.txt +0 -0
- {superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate.egg-info/top_level.txt +0 -0
|
@@ -77,6 +77,50 @@ def get_s3_annotation_paths(folder_path, s3_bucket, annotation_paths, recursive)
|
|
|
77
77
|
return list(set(annotation_paths))
|
|
78
78
|
|
|
79
79
|
|
|
80
|
+
def convert_column_to_lowercase(df, column_name):
|
|
81
|
+
actual_column_name = next(
|
|
82
|
+
(col for col in df.columns if col.lower() == column_name.lower()), None
|
|
83
|
+
)
|
|
84
|
+
if actual_column_name:
|
|
85
|
+
df = df.rename(columns={actual_column_name: column_name})
|
|
86
|
+
else:
|
|
87
|
+
raise Exception(f"Column '{column_name}' not found.")
|
|
88
|
+
return df
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def truncate_long_names(name, length=120):
|
|
92
|
+
if len(name) > length:
|
|
93
|
+
return name[:length]
|
|
94
|
+
else:
|
|
95
|
+
return name
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def get_gen_ai_csv_data(csv_path):
|
|
99
|
+
def serializer_name(val):
|
|
100
|
+
if not str(val).strip():
|
|
101
|
+
val = str(uuid.uuid4())
|
|
102
|
+
val = truncate_long_names(val)
|
|
103
|
+
return val
|
|
104
|
+
|
|
105
|
+
def df_preprocessing(df):
|
|
106
|
+
"""
|
|
107
|
+
Convert the name column to lowercase
|
|
108
|
+
Fill all empty cells with empty strings
|
|
109
|
+
Truncating the name column or generating UUID for empties
|
|
110
|
+
:param df:
|
|
111
|
+
:return: df
|
|
112
|
+
"""
|
|
113
|
+
df = convert_column_to_lowercase(df, "_item_name")
|
|
114
|
+
df = df.fillna("")
|
|
115
|
+
df["_item_name"] = df["_item_name"].apply(serializer_name)
|
|
116
|
+
return df
|
|
117
|
+
|
|
118
|
+
df = pd.read_csv(csv_path, engine="python", quotechar='"', dtype=str)
|
|
119
|
+
df = df.drop(columns=["_folder"], errors="ignore")
|
|
120
|
+
df = df_preprocessing(df)
|
|
121
|
+
return df.to_dict(orient="records")
|
|
122
|
+
|
|
123
|
+
|
|
80
124
|
def get_name_url_duplicated_from_csv(csv_path):
|
|
81
125
|
image_data = pd.read_csv(csv_path, dtype=str)
|
|
82
126
|
image_data.replace({pd.NA: None}, inplace=True)
|
|
@@ -29,6 +29,7 @@ from tqdm import tqdm
|
|
|
29
29
|
import lib.core as constants
|
|
30
30
|
from lib.app.helpers import get_annotation_paths
|
|
31
31
|
from lib.app.helpers import get_name_url_duplicated_from_csv
|
|
32
|
+
from lib.app.helpers import get_gen_ai_csv_data
|
|
32
33
|
from lib.app.helpers import wrap_error as wrap_validation_errors
|
|
33
34
|
from lib.app.interface.base_interface import BaseInterfaceFacade
|
|
34
35
|
from lib.app.interface.base_interface import TrackableMeta
|
|
@@ -45,6 +46,7 @@ from lib.core.conditions import CONDITION_EQ as EQ
|
|
|
45
46
|
from lib.core.conditions import Condition
|
|
46
47
|
from lib.core.conditions import EmptyCondition
|
|
47
48
|
from lib.core.entities import AttachmentEntity
|
|
49
|
+
from lib.core.entities import GenAIAttachmentEntity
|
|
48
50
|
from lib.core.entities import WorkflowEntity
|
|
49
51
|
from lib.core.entities import SettingEntity
|
|
50
52
|
from lib.core.entities.classes import AnnotationClassEntity
|
|
@@ -112,6 +114,12 @@ class Attachment(TypedDict, total=False):
|
|
|
112
114
|
integration: NotRequired[str] # noqa
|
|
113
115
|
|
|
114
116
|
|
|
117
|
+
class GenAIAttachment(TypedDict, total=False):
|
|
118
|
+
_item_name: Optional[str]
|
|
119
|
+
_item_category: Optional[str]
|
|
120
|
+
# compoenmt id value map
|
|
121
|
+
|
|
122
|
+
|
|
115
123
|
class SAClient(BaseInterfaceFacade, metaclass=TrackableMeta):
|
|
116
124
|
"""Create SAClient instance to authorize SDK in a team scope.
|
|
117
125
|
In case of no argument has been provided, SA_TOKEN environmental variable
|
|
@@ -2653,7 +2661,7 @@ class SAClient(BaseInterfaceFacade, metaclass=TrackableMeta):
|
|
|
2653
2661
|
def attach_items(
|
|
2654
2662
|
self,
|
|
2655
2663
|
project: Union[NotEmptyStr, dict],
|
|
2656
|
-
attachments: Union[NotEmptyStr, Path,
|
|
2664
|
+
attachments: Union[NotEmptyStr, Path, List[dict]],
|
|
2657
2665
|
annotation_status: Optional[ANNOTATION_STATUS] = "NotStarted",
|
|
2658
2666
|
):
|
|
2659
2667
|
"""Link items from external storage to SuperAnnotate using URLs.
|
|
@@ -2701,65 +2709,106 @@ class SAClient(BaseInterfaceFacade, metaclass=TrackableMeta):
|
|
|
2701
2709
|
}
|
|
2702
2710
|
]
|
|
2703
2711
|
)
|
|
2712
|
+
|
|
2713
|
+
Example of attaching items for GenAI projects:
|
|
2714
|
+
::
|
|
2715
|
+
|
|
2716
|
+
client = SAClient()
|
|
2717
|
+
client.attach_items(
|
|
2718
|
+
project="Medical Annotations",
|
|
2719
|
+
attachments=[
|
|
2720
|
+
{
|
|
2721
|
+
"_item_name": "item",
|
|
2722
|
+
"_category": "heart",
|
|
2723
|
+
"category_text_input": "value1",
|
|
2724
|
+
"category_numeric_input": 5,
|
|
2725
|
+
"category_approve_input": 0,
|
|
2726
|
+
"category_rating_input": 4,
|
|
2727
|
+
"category_slider_input": 23,
|
|
2728
|
+
"category_multiselect": ["Option 1"]
|
|
2729
|
+
"category_checkbox_input": ["Option 1","Option 3"],
|
|
2730
|
+
}
|
|
2731
|
+
]
|
|
2732
|
+
)
|
|
2704
2733
|
"""
|
|
2705
2734
|
|
|
2706
2735
|
project_name, folder_name = extract_project_folder(project)
|
|
2707
|
-
|
|
2708
|
-
attachments = parse_obj_as(List[AttachmentEntity], attachments)
|
|
2709
|
-
unique_attachments = set(attachments)
|
|
2710
|
-
duplicate_attachments = [
|
|
2711
|
-
item
|
|
2712
|
-
for item, count in collections.Counter(attachments).items()
|
|
2713
|
-
if count > 1
|
|
2714
|
-
]
|
|
2715
|
-
except ValidationError:
|
|
2716
|
-
(
|
|
2717
|
-
unique_attachments,
|
|
2718
|
-
duplicate_attachments,
|
|
2719
|
-
) = get_name_url_duplicated_from_csv(attachments)
|
|
2720
|
-
if duplicate_attachments:
|
|
2721
|
-
logger.info("Dropping duplicates.")
|
|
2722
|
-
unique_attachments = parse_obj_as(List[AttachmentEntity], unique_attachments)
|
|
2736
|
+
project, folder = self.controller.get_project_folder(project_name, folder_name)
|
|
2723
2737
|
uploaded, fails, duplicated = [], [], []
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
if i.type == IntegrationTypeEnum.CUSTOM
|
|
2730
|
-
}
|
|
2731
|
-
invalid_integrations = set()
|
|
2732
|
-
for attachment in unique_attachments:
|
|
2733
|
-
if attachment.integration:
|
|
2734
|
-
if attachment.integration in integtation_item_map:
|
|
2735
|
-
attachment.integration_id = integtation_item_map[
|
|
2736
|
-
attachment.integration
|
|
2737
|
-
].id
|
|
2738
|
-
else:
|
|
2739
|
-
invalid_integrations.add(attachment.integration)
|
|
2740
|
-
continue
|
|
2741
|
-
_unique_attachments.append(attachment)
|
|
2742
|
-
if invalid_integrations:
|
|
2743
|
-
logger.error(
|
|
2744
|
-
f"The ['{','.join(invalid_integrations)}'] integrations specified for the items doesn't exist in the "
|
|
2745
|
-
"list of integrations on the platform. Any associated items will be skipped."
|
|
2738
|
+
if project.type == ProjectType.GEN_AI.value:
|
|
2739
|
+
if isinstance(attachments, (str, Path)):
|
|
2740
|
+
attachments = parse_obj_as(
|
|
2741
|
+
List[GenAIAttachmentEntity],
|
|
2742
|
+
get_gen_ai_csv_data(csv_path=attachments),
|
|
2746
2743
|
)
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
if _unique_attachments:
|
|
2751
|
-
logger.info(
|
|
2752
|
-
f"Attaching {len(_unique_attachments)} file(s) to project {project}."
|
|
2753
|
-
)
|
|
2754
|
-
project, folder = self.controller.get_project_folder(
|
|
2755
|
-
project_name, folder_name
|
|
2756
|
-
)
|
|
2757
|
-
response = self.controller.items.attach(
|
|
2744
|
+
else:
|
|
2745
|
+
attachments = parse_obj_as(List[GenAIAttachmentEntity], attachments)
|
|
2746
|
+
response = self.controller.items.attach_gen_ai_data(
|
|
2758
2747
|
project=project,
|
|
2759
2748
|
folder=folder,
|
|
2760
|
-
attachments=
|
|
2749
|
+
attachments=attachments,
|
|
2761
2750
|
annotation_status=annotation_status,
|
|
2751
|
+
user=self.controller.current_user,
|
|
2752
|
+
)
|
|
2753
|
+
uploaded, duplicated, failed = response.data
|
|
2754
|
+
else:
|
|
2755
|
+
try:
|
|
2756
|
+
attachments = parse_obj_as(List[AttachmentEntity], attachments)
|
|
2757
|
+
unique_attachments = set(attachments)
|
|
2758
|
+
duplicate_attachments = [
|
|
2759
|
+
item
|
|
2760
|
+
for item, count in collections.Counter(attachments).items()
|
|
2761
|
+
if count > 1
|
|
2762
|
+
]
|
|
2763
|
+
except ValidationError:
|
|
2764
|
+
(
|
|
2765
|
+
unique_attachments,
|
|
2766
|
+
duplicate_attachments,
|
|
2767
|
+
) = get_name_url_duplicated_from_csv(attachments)
|
|
2768
|
+
if duplicate_attachments:
|
|
2769
|
+
logger.info("Dropping duplicates.")
|
|
2770
|
+
unique_attachments = parse_obj_as(
|
|
2771
|
+
List[AttachmentEntity], unique_attachments
|
|
2762
2772
|
)
|
|
2773
|
+
_unique_attachments = []
|
|
2774
|
+
if any(i.integration for i in unique_attachments):
|
|
2775
|
+
integtation_item_map = {
|
|
2776
|
+
i.name: i
|
|
2777
|
+
for i in self.controller.integrations.list().data
|
|
2778
|
+
if i.type == IntegrationTypeEnum.CUSTOM
|
|
2779
|
+
}
|
|
2780
|
+
invalid_integrations = set()
|
|
2781
|
+
for attachment in unique_attachments:
|
|
2782
|
+
if attachment.integration:
|
|
2783
|
+
if attachment.integration in integtation_item_map:
|
|
2784
|
+
attachment.integration_id = integtation_item_map[
|
|
2785
|
+
attachment.integration
|
|
2786
|
+
].id
|
|
2787
|
+
else:
|
|
2788
|
+
invalid_integrations.add(attachment.integration)
|
|
2789
|
+
continue
|
|
2790
|
+
_unique_attachments.append(attachment)
|
|
2791
|
+
if invalid_integrations:
|
|
2792
|
+
logger.error(
|
|
2793
|
+
f"The ['{','.join(invalid_integrations)}'] integrations specified for the items doesn't exist in the "
|
|
2794
|
+
"list of integrations on the platform. Any associated items will be skipped."
|
|
2795
|
+
)
|
|
2796
|
+
else:
|
|
2797
|
+
_unique_attachments = unique_attachments
|
|
2798
|
+
|
|
2799
|
+
if _unique_attachments:
|
|
2800
|
+
logger.info(
|
|
2801
|
+
f"Attaching {len(_unique_attachments)} file(s) to project {project}."
|
|
2802
|
+
)
|
|
2803
|
+
project, folder = self.controller.get_project_folder(
|
|
2804
|
+
project_name, folder_name
|
|
2805
|
+
)
|
|
2806
|
+
response = self.controller.items.attach(
|
|
2807
|
+
project=project,
|
|
2808
|
+
folder=folder,
|
|
2809
|
+
attachments=_unique_attachments,
|
|
2810
|
+
annotation_status=annotation_status,
|
|
2811
|
+
)
|
|
2763
2812
|
if response.errors:
|
|
2764
2813
|
raise AppException(response.errors)
|
|
2765
2814
|
uploaded, duplicated = response.data
|
{superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/entities/__init__.py
RENAMED
|
@@ -12,6 +12,7 @@ from lib.core.entities.items import TiledEntity
|
|
|
12
12
|
from lib.core.entities.items import VideoEntity
|
|
13
13
|
from lib.core.entities.project import AttachmentEntity
|
|
14
14
|
from lib.core.entities.project import ContributorEntity
|
|
15
|
+
from lib.core.entities.project import GenAIAttachmentEntity
|
|
15
16
|
from lib.core.entities.project import MLModelEntity
|
|
16
17
|
from lib.core.entities.project import ProjectEntity
|
|
17
18
|
from lib.core.entities.project import SettingEntity
|
|
@@ -37,6 +38,7 @@ __all__ = [
|
|
|
37
38
|
"DocumentEntity",
|
|
38
39
|
# Utils
|
|
39
40
|
"AttachmentEntity",
|
|
41
|
+
"GenAIAttachmentEntity",
|
|
40
42
|
# project
|
|
41
43
|
"ProjectEntity",
|
|
42
44
|
"ContributorEntity",
|
{superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/entities/project.py
RENAMED
|
@@ -50,6 +50,29 @@ class AttachmentEntity(BaseModel):
|
|
|
50
50
|
return hash(self.name)
|
|
51
51
|
|
|
52
52
|
|
|
53
|
+
class GenAIAttachmentEntity(BaseModel):
|
|
54
|
+
_item_name: Optional[str] = Field(default_factory=lambda: str(uuid.uuid4()))
|
|
55
|
+
_item_category: Optional[str] = None
|
|
56
|
+
|
|
57
|
+
integration: Optional[str] = None
|
|
58
|
+
integration_id: Optional[int] = None
|
|
59
|
+
|
|
60
|
+
@property
|
|
61
|
+
def name(self):
|
|
62
|
+
return self._item_name
|
|
63
|
+
|
|
64
|
+
@property
|
|
65
|
+
def item_categoty(self):
|
|
66
|
+
return self._item_category
|
|
67
|
+
|
|
68
|
+
class Config:
|
|
69
|
+
include_private_fields = True
|
|
70
|
+
extra = Extra.allow
|
|
71
|
+
|
|
72
|
+
def __hash__(self):
|
|
73
|
+
return hash(self.name)
|
|
74
|
+
|
|
75
|
+
|
|
53
76
|
class WorkflowEntity(BaseModel):
|
|
54
77
|
id: Optional[int]
|
|
55
78
|
project_id: Optional[int]
|
{superannotate-4.4.23b1 → superannotate-4.4.24.dev2}/src/superannotate/lib/core/serviceproviders.py
RENAMED
|
@@ -28,7 +28,6 @@ from lib.core.service_types import UploadCustomFieldValuesResponse
|
|
|
28
28
|
from lib.core.service_types import UserLimitsResponse
|
|
29
29
|
from lib.core.service_types import UserResponse
|
|
30
30
|
from lib.core.types import Attachment
|
|
31
|
-
from lib.core.types import AttachmentMeta
|
|
32
31
|
|
|
33
32
|
|
|
34
33
|
class BaseClient(ABC):
|
|
@@ -154,6 +153,26 @@ class BaseProjectService(SuperannotateServiceProvider):
|
|
|
154
153
|
) -> ServiceResponse:
|
|
155
154
|
raise NotImplementedError
|
|
156
155
|
|
|
156
|
+
@abstractmethod
|
|
157
|
+
def list_categories(
|
|
158
|
+
self,
|
|
159
|
+
project_id: int,
|
|
160
|
+
):
|
|
161
|
+
raise NotImplementedError
|
|
162
|
+
|
|
163
|
+
@abstractmethod
|
|
164
|
+
def create_categories(self, project_id: int, categories: List[str]):
|
|
165
|
+
raise NotImplementedError
|
|
166
|
+
|
|
167
|
+
@abstractmethod
|
|
168
|
+
def attach_categories(
|
|
169
|
+
self,
|
|
170
|
+
project_id: int,
|
|
171
|
+
folder_id: int,
|
|
172
|
+
item_id_category_id_map: Dict[int, dict],
|
|
173
|
+
):
|
|
174
|
+
raise NotImplementedError
|
|
175
|
+
|
|
157
176
|
|
|
158
177
|
class BaseFolderService(SuperannotateServiceProvider):
|
|
159
178
|
@abstractmethod
|
|
@@ -262,7 +281,7 @@ class BaseItemService(SuperannotateServiceProvider):
|
|
|
262
281
|
attachments: List[Attachment],
|
|
263
282
|
annotation_status_code,
|
|
264
283
|
upload_state_code,
|
|
265
|
-
meta: Dict[str,
|
|
284
|
+
meta: Dict[str, dict],
|
|
266
285
|
) -> ServiceResponse:
|
|
267
286
|
raise NotImplementedError
|
|
268
287
|
|
|
@@ -376,6 +395,7 @@ class BaseAnnotationService(SuperannotateServiceProvider):
|
|
|
376
395
|
project: entities.ProjectEntity,
|
|
377
396
|
folder: entities.FolderEntity,
|
|
378
397
|
items_name_data_map: Dict[str, dict],
|
|
398
|
+
transform_version: str = None,
|
|
379
399
|
) -> UploadAnnotationsResponse:
|
|
380
400
|
raise NotImplementedError
|
|
381
401
|
|
|
@@ -183,6 +183,7 @@ async def upload_small_annotations(
|
|
|
183
183
|
reporter: Reporter,
|
|
184
184
|
report: Report,
|
|
185
185
|
callback: Callable = None,
|
|
186
|
+
transform_version: str = None,
|
|
186
187
|
):
|
|
187
188
|
async def upload(_chunk: List[ItemToUpload]):
|
|
188
189
|
failed_annotations, missing_classes, missing_attr_groups, missing_attrs = (
|
|
@@ -199,6 +200,7 @@ async def upload_small_annotations(
|
|
|
199
200
|
project=project,
|
|
200
201
|
folder=folder,
|
|
201
202
|
items_name_data_map=items_name_data_map,
|
|
203
|
+
transform_version=transform_version,
|
|
202
204
|
)
|
|
203
205
|
if response.ok:
|
|
204
206
|
if response.data.failed_items: # noqa
|
|
@@ -299,6 +301,7 @@ class UploadAnnotationsUseCase(BaseReportableUseCase):
|
|
|
299
301
|
service_provider: BaseServiceProvider,
|
|
300
302
|
user: UserEntity,
|
|
301
303
|
keep_status: bool = False,
|
|
304
|
+
transform_version: str = None,
|
|
302
305
|
):
|
|
303
306
|
super().__init__(reporter)
|
|
304
307
|
self._project = project
|
|
@@ -308,6 +311,7 @@ class UploadAnnotationsUseCase(BaseReportableUseCase):
|
|
|
308
311
|
self._keep_status = keep_status
|
|
309
312
|
self._report = Report([], [], [], [])
|
|
310
313
|
self._user = user
|
|
314
|
+
self._transform_version = transform_version
|
|
311
315
|
|
|
312
316
|
def validate_project_type(self):
|
|
313
317
|
if self._project.type == constants.ProjectType.PIXEL.value:
|
|
@@ -413,6 +417,7 @@ class UploadAnnotationsUseCase(BaseReportableUseCase):
|
|
|
413
417
|
service_provider=self._service_provider,
|
|
414
418
|
reporter=self.reporter,
|
|
415
419
|
report=self._report,
|
|
420
|
+
transform_version=self._transform_version,
|
|
416
421
|
)
|
|
417
422
|
)
|
|
418
423
|
|