|
16 | 16 | from labelbox.orm.db_object import DbObject, Updateable, Deletable |
17 | 17 | from labelbox.orm.model import Entity, Field, Relationship |
18 | 18 | from labelbox.pagination import PaginatedCollection |
| 19 | +from labelbox.schema.consensus_settings import ConsensusSettings |
19 | 20 | from labelbox.schema.media_type import MediaType |
20 | 21 | from labelbox.schema.queue_mode import QueueMode |
21 | 22 | from labelbox.schema.resource_tag import ResourceTag |
@@ -561,14 +562,18 @@ def setup(self, labeling_frontend, labeling_frontend_options) -> None: |
561 | 562 | timestamp = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ") |
562 | 563 | self.update(setup_complete=timestamp) |
563 | 564 |
|
564 | | - def create_batch(self, name: str, data_rows: List[str], priority: int = 5): |
| 565 | + def create_batch(self, |
| 566 | + name: str, |
| 567 | + data_rows: List[str], |
| 568 | + priority: int = 5, |
| 569 | + consensus_settings: Optional[Dict[str, float]] = None): |
565 | 570 | """Create a new batch for a project. Batches is in Beta and subject to change |
566 | 571 |
|
567 | 572 | Args: |
568 | 573 | name: a name for the batch, must be unique within a project |
569 | 574 | data_rows: Either a list of `DataRows` or Data Row ids |
570 | 575 | priority: An optional priority for the Data Rows in the Batch. 1 highest -> 5 lowest |
571 | | -
|
| 576 | + consensus_settings: An optional dictionary with consensus settings: {'number_of_labels': 3, 'coverage_percentage': 0.1} |
572 | 577 | """ |
573 | 578 |
|
574 | 579 | # @TODO: make this automatic? |
@@ -600,12 +605,16 @@ def create_batch(self, name: str, data_rows: List[str], priority: int = 5): |
600 | 605 | } |
601 | 606 | """ % (method, method, query.results_query_part(Entity.Batch)) |
602 | 607 |
|
| 608 | + if consensus_settings: |
| 609 | + consensus_settings = ConsensusSettings(**consensus_settings).dict( |
| 610 | + by_alias=True) |
603 | 611 | params = { |
604 | 612 | "projectId": self.uid, |
605 | 613 | "batchInput": { |
606 | 614 | "name": name, |
607 | 615 | "dataRowIds": dr_ids, |
608 | | - "priority": priority |
| 616 | + "priority": priority, |
| 617 | + "consensusSettings": consensus_settings |
609 | 618 | } |
610 | 619 | } |
611 | 620 |
|
|
0 commit comments