Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/superannotate/lib/app/interface/sdk_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,7 @@ def prepare_export(
:param kwargs:
Arbitrary kwargs::
* integration_name: can be provided which will be used as a storage to store export file
* export_type: can be CSV for the Gen AI projects
* format: can be CSV for the Gen AI projects

:return: metadata object of the prepared export
:rtype: dict
Expand Down Expand Up @@ -1219,9 +1219,11 @@ def prepare_export(
else:
raise AppException("Integration not found.")
_export_type = None
export_type = kwargs.get("export_type")
if export_type and export_type == "csv":
_export_type = 3
export_type = kwargs.get("format")
if export_type:
export_type = export_type.lower()
if export_type == "csv":
_export_type = 3
response = self.controller.prepare_export(
project_name=project_name,
folder_names=folders,
Expand Down
2 changes: 1 addition & 1 deletion src/superannotate/lib/core/usecases/annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,7 @@ def execute(self):
)
self._response.data = (uploaded_score_names, skipped_score_names)
else:
self.reporter.warning_messages("Empty scores.")
self.reporter.warning_messages.append("Empty scores.")
return self._response


Expand Down
14 changes: 14 additions & 0 deletions src/superannotate/lib/core/usecases/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,20 @@ def validate_fuse(self):
f"{ProjectType.get_name(self._project.type)} attached with URLs"
)

def validate_export_type(self):
if self._export_type == 2:
if (
self._project.type != ProjectType.VECTOR.value
or self._project.upload_state != constances.UploadState.EXTERNAL.value
):
raise AppValidationException(
"COCO format is not supported for this project."
)
elif self._export_type == 3 and self._project.type != ProjectType.GEN_AI.value:
raise AppValidationException(
"CSV format is not supported for this project."
)

def validate_folder_names(self):
if self._folder_names:
condition = Condition("project_id", self._project.id, EQ)
Expand Down
6 changes: 6 additions & 0 deletions tests/integration/test_upload_priority_scores.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
from pathlib import Path
from unittest import mock

from src.superannotate import SAClient
from tests.integration.base import BaseTestCase
Expand All @@ -17,6 +18,11 @@ class TestUploadPriorityScores(BaseTestCase):
def folder_path(self):
return os.path.join(Path(__file__).parent.parent, self.TEST_FOLDER_PATH)

def test_upload_empty_list(self):
with self.assertLogs("sa", level="INFO") as cm:
sa.upload_priority_scores(self.PROJECT_NAME, scores=[])
assert cm.output[0] == 'INFO:sa:Uploading priority scores for 0 item(s) to TestUploadPriorityScores.'

def test_upload_priority_scores(self):

self._attach_items(count=4)
Expand Down