|
14 | 14 | class ClassificationResult(BaseModel):
|
15 | 15 | confidence: Optional[confloat(ge=0.0, le=1.0)] = Field(
|
16 | 16 | None,
|
17 |
| - description='On a scale of 0 to 1, how confident are we in the predicted label?', |
| 17 | + description="On a scale of 0 to 1, how confident are we in the predicted label?", |
18 | 18 | )
|
19 |
| - label: str = Field(..., description='What is the predicted label?') |
| 19 | + label: str = Field(..., description="What is the predicted label?") |
20 | 20 |
|
21 | 21 |
|
22 | 22 | class DetectorCreationInput(BaseModel):
|
23 |
| - name: constr(max_length=200) = Field( |
24 |
| - ..., description='A short, descriptive name for the detector.' |
25 |
| - ) |
26 |
| - query: constr(max_length=300) = Field( |
27 |
| - ..., description='A question about the image.' |
28 |
| - ) |
| 23 | + name: constr(max_length=200) = Field(..., description="A short, descriptive name for the detector.") |
| 24 | + query: constr(max_length=300) = Field(..., description="A question about the image.") |
29 | 25 | group_name: Optional[constr(max_length=100)] = Field(
|
30 |
| - None, description='Which group should this detector be part of?' |
| 26 | + None, description="Which group should this detector be part of?" |
31 | 27 | )
|
32 | 28 | confidence_threshold: Optional[confloat(ge=0.0, le=1.0)] = Field(
|
33 | 29 | 0.9,
|
34 | 30 | description="If the detector's prediction is below this confidence threshold, send the image query for human review.",
|
35 | 31 | )
|
36 | 32 | config_name: Optional[constr(max_length=100)] = Field(
|
37 | 33 | None,
|
38 |
| - description='(Advanced usage) If your account has multiple named ML configuration options enabled, you can use this field to specify which one you would like to use.', |
| 34 | + description="(Advanced usage) If your account has multiple named ML configuration options enabled, you can use this field to specify which one you would like to use.", |
39 | 35 | )
|
40 | 36 |
|
41 | 37 |
|
42 | 38 | class DetectorTypeEnum(Enum):
|
43 |
| - detector = 'detector' |
| 39 | + detector = "detector" |
44 | 40 |
|
45 | 41 |
|
46 | 42 | class ImageQueryTypeEnum(Enum):
|
47 |
| - image_query = 'image_query' |
| 43 | + image_query = "image_query" |
48 | 44 |
|
49 | 45 |
|
50 | 46 | class ResultTypeEnum(Enum):
|
51 |
| - binary_classification = 'binary_classification' |
| 47 | + binary_classification = "binary_classification" |
52 | 48 |
|
53 | 49 |
|
54 | 50 | class Detector(BaseModel):
|
55 |
| - id: str = Field(..., description='A unique ID for this object.') |
56 |
| - type: DetectorTypeEnum = Field(..., description='The type of this object.') |
57 |
| - created_at: datetime = Field(..., description='When this detector was created.') |
58 |
| - name: constr(max_length=200) = Field( |
59 |
| - ..., description='A short, descriptive name for the detector.' |
60 |
| - ) |
61 |
| - query: str = Field(..., description='A question about the image.') |
62 |
| - group_name: str = Field( |
63 |
| - ..., description='Which group should this detector be part of?' |
64 |
| - ) |
| 51 | + id: str = Field(..., description="A unique ID for this object.") |
| 52 | + type: DetectorTypeEnum = Field(..., description="The type of this object.") |
| 53 | + created_at: datetime = Field(..., description="When this detector was created.") |
| 54 | + name: constr(max_length=200) = Field(..., description="A short, descriptive name for the detector.") |
| 55 | + query: str = Field(..., description="A question about the image.") |
| 56 | + group_name: str = Field(..., description="Which group should this detector be part of?") |
65 | 57 | confidence_threshold: Optional[confloat(ge=0.0, le=1.0)] = Field(
|
66 | 58 | 0.9,
|
67 | 59 | description="If the detector's prediction is below this confidence threshold, send the image query for human review.",
|
68 | 60 | )
|
69 | 61 |
|
70 | 62 |
|
71 | 63 | class ImageQuery(BaseModel):
|
72 |
| - id: str = Field(..., description='A unique ID for this object.') |
73 |
| - type: ImageQueryTypeEnum = Field(..., description='The type of this object.') |
74 |
| - created_at: datetime = Field(..., description='When was this detector created?') |
75 |
| - query: str = Field(..., description='A question about the image.') |
76 |
| - detector_id: str = Field( |
77 |
| - ..., description='Which detector was used on this image query?' |
78 |
| - ) |
79 |
| - result_type: ResultTypeEnum = Field( |
80 |
| - ..., description='What type of result are we returning?' |
81 |
| - ) |
| 64 | + id: str = Field(..., description="A unique ID for this object.") |
| 65 | + type: ImageQueryTypeEnum = Field(..., description="The type of this object.") |
| 66 | + created_at: datetime = Field(..., description="When was this detector created?") |
| 67 | + query: str = Field(..., description="A question about the image.") |
| 68 | + detector_id: str = Field(..., description="Which detector was used on this image query?") |
| 69 | + result_type: ResultTypeEnum = Field(..., description="What type of result are we returning?") |
82 | 70 | result: ClassificationResult
|
83 | 71 |
|
84 | 72 |
|
85 | 73 | class PaginatedDetectorList(BaseModel):
|
86 | 74 | count: Optional[int] = Field(None, example=123)
|
87 |
| - next: Optional[AnyUrl] = Field( |
88 |
| - None, example='http://api.example.org/accounts/?page=4' |
89 |
| - ) |
90 |
| - previous: Optional[AnyUrl] = Field( |
91 |
| - None, example='http://api.example.org/accounts/?page=2' |
92 |
| - ) |
| 75 | + next: Optional[AnyUrl] = Field(None, example="http://api.example.org/accounts/?page=4") |
| 76 | + previous: Optional[AnyUrl] = Field(None, example="http://api.example.org/accounts/?page=2") |
93 | 77 | results: Optional[List[Detector]] = None
|
94 | 78 |
|
95 | 79 |
|
96 | 80 | class PaginatedImageQueryList(BaseModel):
|
97 | 81 | count: Optional[int] = Field(None, example=123)
|
98 |
| - next: Optional[AnyUrl] = Field( |
99 |
| - None, example='http://api.example.org/accounts/?page=4' |
100 |
| - ) |
101 |
| - previous: Optional[AnyUrl] = Field( |
102 |
| - None, example='http://api.example.org/accounts/?page=2' |
103 |
| - ) |
| 82 | + next: Optional[AnyUrl] = Field(None, example="http://api.example.org/accounts/?page=4") |
| 83 | + previous: Optional[AnyUrl] = Field(None, example="http://api.example.org/accounts/?page=2") |
104 | 84 | results: Optional[List[ImageQuery]] = None
|
0 commit comments