Skip to content

Commit 16728d0

Browse files
Grant EatonGrant Eaton
authored andcommitted
pr comments
1 parent bc49d5c commit 16728d0

File tree

3 files changed

+24
-14
lines changed

3 files changed

+24
-14
lines changed

labelbox/schema/annotation_import.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def from_name(cls,
266266

267267
@classmethod
268268
def _get_url_mutation(cls) -> str:
269-
return """mutation createMEAPredictionImportPyApi($modelRunId : ID!, $name: String!, $fileUrl: String!) {
269+
return """mutation createMEAPredictionImportByUrlPyApi($modelRunId : ID!, $name: String!, $fileUrl: String!) {
270270
createModelErrorAnalysisPredictionImport(data: {
271271
modelRunId: $modelRunId
272272
name: $name
@@ -276,7 +276,7 @@ def _get_url_mutation(cls) -> str:
276276

277277
@classmethod
278278
def _get_file_mutation(cls) -> str:
279-
return """mutation createMEAPredictionImportPyApi($modelRunId : ID!, $name: String!, $file: Upload!, $contentLength: Int!) {
279+
return """mutation createMEAPredictionImportByFilePyApi($modelRunId : ID!, $name: String!, $file: Upload!, $contentLength: Int!) {
280280
createModelErrorAnalysisPredictionImport(data: {
281281
modelRunId: $modelRunId name: $name filePayload: { file: $file, contentLength: $contentLength}
282282
}) {%s}
@@ -423,7 +423,7 @@ def from_name(cls,
423423

424424
@classmethod
425425
def _get_url_mutation(cls) -> str:
426-
return """mutation createMALPredictionImportPyApi($projectId : ID!, $name: String!, $fileUrl: String!) {
426+
return """mutation createMALPredictionImportByUrlPyApi($projectId : ID!, $name: String!, $fileUrl: String!) {
427427
createModelAssistedLabelingPredictionImport(data: {
428428
projectId: $projectId
429429
name: $name
@@ -433,7 +433,7 @@ def _get_url_mutation(cls) -> str:
433433

434434
@classmethod
435435
def _get_file_mutation(cls) -> str:
436-
return """mutation createMALPredictionImportPyApi($projectId : ID!, $name: String!, $file: Upload!, $contentLength: Int!) {
436+
return """mutation createMALPredictionImportByFilePyApi($projectId : ID!, $name: String!, $file: Upload!, $contentLength: Int!) {
437437
createModelAssistedLabelingPredictionImport(data: {
438438
projectId: $projectId name: $name filePayload: { file: $file, contentLength: $contentLength}
439439
}) {%s}
@@ -493,7 +493,7 @@ def create_from_objects(cls, client: "labelbox.Client", project_id: str,
493493
name: str,
494494
labels: List[Dict[str, Any]]) -> "LabelImport":
495495
"""
496-
Create an label import job from an in memory dictionary
496+
Create a label import job from an in memory dictionary
497497
498498
Args:
499499
client: Labelbox Client for executing queries
@@ -514,7 +514,7 @@ def create_from_objects(cls, client: "labelbox.Client", project_id: str,
514514
def create_from_url(cls, client: "labelbox.Client", project_id: str,
515515
name: str, url: str) -> "LabelImport":
516516
"""
517-
Create an label annotation import job from a url
517+
Create a label annotation import job from a url
518518
The url must point to a file containing label annotations.
519519
520520
Args:
@@ -573,7 +573,7 @@ def from_name(cls,
573573

574574
@classmethod
575575
def _get_url_mutation(cls) -> str:
576-
return """mutation createLabelImportPyApi($projectId : ID!, $name: String!, $fileUrl: String!) {
576+
return """mutation createLabelImportByUrlPyApi($projectId : ID!, $name: String!, $fileUrl: String!) {
577577
createLabelImport(data: {
578578
projectId: $projectId
579579
name: $name
@@ -583,7 +583,7 @@ def _get_url_mutation(cls) -> str:
583583

584584
@classmethod
585585
def _get_file_mutation(cls) -> str:
586-
return """mutation createLabelImportPyApi($projectId : ID!, $name: String!, $file: Upload!, $contentLength: Int!) {
586+
return """mutation createLabelImportByFilePyApi($projectId : ID!, $name: String!, $file: Upload!, $contentLength: Int!) {
587587
createLabelImport(data: {
588588
projectId: $projectId name: $name filePayload: { file: $file, contentLength: $contentLength}
589589
}) {%s}

test.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from labelbox import Client
2+
import os
3+
from labelbox.schema.annotation_import import MEAPredictionImport
4+
from labelbox.schema.annotation_import import MALPredictionImport
5+
from labelbox.schema.annotation_import import LabelImport
6+
client = Client(api_key="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJja3RxcTdmMjcwMDAxZ3dzYjh1b28yanduIiwib3JnYW5pemF0aW9uSWQiOiJja3RxcTdmMDkwMDAwZ3dzYmh0c2RmZmlsIiwiaWF0IjoxNjMyMDI2MTA4LCJleHAiOjE2MzI2MzA5MDh9.F4yQsuq1L-XFX4WiN9duf0s9xxpHZUn3YkMSJd4ZG1Y", endpoint="http://localhost:8080/_gql")
7+
b = LabelImport.create_from_url(client, "ckhmkoa24001e0789rf41gm3p", "test-label-import-1",
8+
"https://storage.labelbox.com/ckk4q1vgapsau07324awnsjq2%2F388e1da0-5a2e-56b0-227f-18e452e6ac1f-1?Expires=1622247070155&KeyName=labelbox-assets-key-3&Signature=UdKsAaYAMYg0WSGZqApHoyR87Us")
9+
# b = LabelImport.from_name(client, "ckhmkoa24001e0789rf41gm3p", "test-label-import-1")
10+
print(b)

tests/integration/annotation_import/test_label_import.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,25 +55,25 @@ def test_get(client, project, annotation_import_test_helpers):
5555

5656

5757
@pytest.mark.slow
58-
def test_wait_till_done(client, project, model_run_predictions):
58+
def test_wait_till_done(client, project, predictions):
5959
name = str(uuid.uuid4())
60-
label_import = LabelImport.create_from_objects(client=client, project_id=project.uid, name=name, labels=model_run_predictions)
60+
label_import = LabelImport.create_from_objects(client=client, project_id=project.uid, name=name, labels=predictions)
6161

62-
assert len(label_import.inputs) == len(model_run_predictions)
62+
assert len(label_import.inputs) == len(predictions)
6363
label_import.wait_until_done()
6464
# TODO(grant): some of this is commented out
6565
# TODO(grant): since the pipeline is not complete, you will get a failed status
6666

6767
# assert label_import.state == AnnotationImportState.FINISHED
6868
# # Check that the status files are being returned as expected
6969
# assert len(label_import.errors) == 0
70-
assert len(label_import.inputs) == len(model_run_predictions)
70+
assert len(label_import.inputs) == len(predictions)
7171
input_uuids = [
7272
input_annot['uuid'] for input_annot in label_import.inputs
7373
]
74-
inference_uuids = [pred['uuid'] for pred in model_run_predictions]
74+
inference_uuids = [pred['uuid'] for pred in predictions]
7575
assert set(input_uuids) == set(inference_uuids)
76-
assert len(label_import.statuses) == len(model_run_predictions)
76+
assert len(label_import.statuses) == len(predictions)
7777
# for status in label_import.statuses:
7878
# assert status['status'] == 'SUCCESS'
7979
status_uuids = [

0 commit comments

Comments
 (0)