Before uploading predictions, you must define an Ontology using OntologyBuilder. The ontology must include classifications (Radio, Checklist, Text) and tools (BBOX, NER) that match your model's output.
For complex models, you can nest classifications within tools or within other classifications (e.g., a Radio classification that contains a sub-checklist).
import labelbox as lb
ontology_builder = lb.OntologyBuilder(
classifications=[
lb.Classification(
class_type=lb.Classification.Type.RADIO,
name="radio_question",
scope=lb.Classification.Scope.GLOBAL,
options=[lb.Option(value="first_radio_answer")],
),
# ... other classifications
],
tools=[
lb.Tool(tool=lb.Tool.Type.BBOX, name="bounding_box"),
lb.Tool(tool=lb.Tool.Type.NER, name="named_entity"),
],
)
ontology = client.create_ontology(
"Document Annotation Import Demo",
ontology_builder.asdict(),
media_type=lb.MediaType.Document,
)