|
1 | | -from typing import Optional |
2 | | - |
3 | 1 | from mindee.parsing.common.string_dict import StringDict |
| 2 | +from mindee.parsing.v2.inference_active_options import ActiveOptions |
4 | 3 | from mindee.parsing.v2.inference_file import InferenceFile |
5 | 4 | from mindee.parsing.v2.inference_model import InferenceModel |
6 | 5 | from mindee.parsing.v2.inference_result import InferenceResult |
|
9 | 8 | class Inference: |
10 | 9 | """Inference object for a V2 API return.""" |
11 | 10 |
|
| 11 | + id: str |
| 12 | + """ID of the inference.""" |
12 | 13 | model: InferenceModel |
13 | 14 | """Model info for the inference.""" |
14 | 15 | file: InferenceFile |
15 | 16 | """File info for the inference.""" |
16 | 17 | result: InferenceResult |
17 | 18 | """Result of the inference.""" |
18 | | - id: Optional[str] |
19 | | - """ID of the inference.""" |
| 19 | + active_options: ActiveOptions |
| 20 | + """Active options for the inference.""" |
20 | 21 |
|
21 | 22 | def __init__(self, raw_response: StringDict): |
| 23 | + self.id = raw_response["id"] |
22 | 24 | self.model = InferenceModel(raw_response["model"]) |
23 | 25 | self.file = InferenceFile(raw_response["file"]) |
24 | 26 | self.result = InferenceResult(raw_response["result"]) |
25 | | - self.id = raw_response["id"] if "id" in raw_response else None |
| 27 | + self.active_options = ActiveOptions(raw_response["active_options"]) |
26 | 28 |
|
27 | 29 | def __str__(self) -> str: |
28 | 30 | return ( |
29 | | - f"Inference\n#########\n" |
30 | | - f"{self.model}\n\n" |
31 | | - f"{self.file}" |
32 | | - f"{self.result}\n" |
| 31 | + f"Inference\n#########" |
| 32 | + f"\n{self.model}" |
| 33 | + f"\n\n{self.file}" |
| 34 | + f"\n\n{self.active_options}" |
| 35 | + f"\n\n{self.result}\n" |
33 | 36 | ) |
0 commit comments