Skip to content

Commit 766dfa3

Browse files
committed
feat(LAB-3861): add label_type, step_name & model_name to import GeoJSON/Shapefiles
1 parent fb208c8 commit 766dfa3

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/kili/presentation/client/label.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,6 +1365,9 @@ def append_labels_from_shapefiles(
13651365
job_names: List[str],
13661366
category_names: List[str],
13671367
from_epsgs: Optional[List[int]] = None,
1368+
label_type: Optional[LabelType] = "DEFAULT",
1369+
step_name: Optional[str] = None,
1370+
model_name: Optional[str] = None,
13681371
):
13691372
"""Import and convert shapefiles into annotations for a specific asset in a Kili project.
13701373
@@ -1383,6 +1386,11 @@ def append_labels_from_shapefiles(
13831386
from_epsgs: Optional list of EPSG codes specifying the coordinate reference systems
13841387
of the shapefiles. If not provided, EPSG:4326 (WGS84) is assumed for all files.
13851388
All geometries will be transformed to EPSG:4326 before being added to Kili.
1389+
label_type: Can be one of `AUTOSAVE`, `DEFAULT`, `PREDICTION`, `REVIEW` or `INFERENCE`.
1390+
step_name: Name of the step to which the labels belong.
1391+
The label_type must match accordingly.
1392+
model_name: Name of the model that generated the labels.
1393+
Only useful when uploading PREDICTION or INFERENCE labels.
13861394
13871395
Note:
13881396
This function requires the 'gis' extra dependencies.
@@ -1404,6 +1412,9 @@ def append_labels_from_shapefiles(
14041412
project_id=project_id,
14051413
json_response_array=[json_response],
14061414
asset_external_id_array=[asset_external_id],
1415+
label_type=label_type,
1416+
step_name=step_name,
1417+
model_name=model_name,
14071418
)
14081419

14091420
# pylint: disable=too-many-branches
@@ -1415,6 +1426,9 @@ def append_labels_from_geojson_files(
14151426
geojson_file_paths: List[str],
14161427
job_names: Optional[List[str]] = None,
14171428
category_names: Optional[List[str]] = None,
1429+
label_type: Optional[LabelType] = "DEFAULT",
1430+
step_name: Optional[str] = None,
1431+
model_name: Optional[str] = None,
14181432
):
14191433
"""Import and convert GeoJSON files into annotations for a specific asset in a Kili project.
14201434
@@ -1444,6 +1458,12 @@ def append_labels_from_geojson_files(
14441458
When provided, all geometries from the corresponding file will be assigned
14451459
to this category. Must have the same length as `geojson_file_paths`.
14461460
Each category must exist in the corresponding job's ontology.
1461+
label_type: Can be one of `AUTOSAVE`, `DEFAULT`, `PREDICTION`, `REVIEW` or `INFERENCE`.
1462+
step_name: Name of the step to which the labels belong.
1463+
The label_type must match accordingly.
1464+
model_name: Name of the model that generated the labels.
1465+
Only useful when uploading PREDICTION or INFERENCE labels.
1466+
14471467
14481468
Note:
14491469
**Geometry-to-job compatibility:**
@@ -1549,4 +1569,7 @@ def append_labels_from_geojson_files(
15491569
project_id=project_id,
15501570
json_response_array=[merged_json_response],
15511571
asset_external_id_array=[asset_external_id],
1572+
label_type=label_type,
1573+
step_name=step_name,
1574+
model_name=model_name,
15521575
)

0 commit comments

Comments
 (0)