|
29 | 29 | assert cms_globals.props is not None, "Current active user dependency not injected" |
30 | 30 | assert cms_globals.model_service_dep is not None, "Model service dependency not injected" |
31 | 31 |
|
32 | | -@router.post("/sanity-check", |
33 | | - tags=[Tags.Evaluating.name], |
34 | | - response_class=StreamingResponse, |
35 | | - dependencies=[Depends(cms_globals.props.current_active_user)], |
36 | | - description="Sanity check the model being served with a trainer export") |
37 | | -def get_sanity_check_with_trainer_export(request: Request, |
38 | | - trainer_export: Annotated[List[UploadFile], File(description="One or more trainer export files to be uploaded")], |
39 | | - tracking_id: Union[str, None] = Depends(validate_tracking_id), |
40 | | - model_service: AbstractModelService = Depends(cms_globals.model_service_dep)) -> StreamingResponse: |
| 32 | +@router.post( |
| 33 | + "/sanity-check", |
| 34 | + tags=[Tags.Evaluating.name], |
| 35 | + response_class=StreamingResponse, |
| 36 | + dependencies=[Depends(cms_globals.props.current_active_user)], |
| 37 | + description="Sanity check the model being served with a trainer export", |
| 38 | +) |
| 39 | +def get_sanity_check_with_trainer_export( |
| 40 | + request: Request, |
| 41 | + trainer_export: Annotated[List[UploadFile], File(description="One or more trainer export files to be uploaded")], |
| 42 | + tracking_id: Union[str, None] = Depends(validate_tracking_id), |
| 43 | + model_service: AbstractModelService = Depends(cms_globals.model_service_dep), |
| 44 | +) -> StreamingResponse: |
41 | 45 | """ |
42 | 46 | Performs a sanity check on the running model using the provided trainer export files. |
43 | 47 |
|
@@ -77,17 +81,21 @@ def get_sanity_check_with_trainer_export(request: Request, |
77 | 81 | return response |
78 | 82 |
|
79 | 83 |
|
80 | | -@router.post("/iaa-scores", |
81 | | - tags=[Tags.Evaluating.name], |
82 | | - response_class=StreamingResponse, |
83 | | - dependencies=[Depends(cms_globals.props.current_active_user)], |
84 | | - description="Calculate inter annotator agreement scores between two projects") |
85 | | -def get_inter_annotator_agreement_scores(request: Request, |
86 | | - trainer_export: Annotated[List[UploadFile], File(description="A list of trainer export files to be uploaded")], |
87 | | - annotator_a_project_id: Annotated[int, Query(description="The project ID from one annotator")], |
88 | | - annotator_b_project_id: Annotated[int, Query(description="The project ID from another annotator")], |
89 | | - scope: Annotated[str, Query(enum=[s.value for s in Scope], description="The scope for which the score will be calculated, e.g., per_concept, per_document or per_span")], |
90 | | - tracking_id: Union[str, None] = Depends(validate_tracking_id)) -> StreamingResponse: |
| 84 | +@router.post( |
| 85 | + "/iaa-scores", |
| 86 | + tags=[Tags.Evaluating.name], |
| 87 | + response_class=StreamingResponse, |
| 88 | + dependencies=[Depends(cms_globals.props.current_active_user)], |
| 89 | + description="Calculate inter annotator agreement scores between two projects", |
| 90 | +) |
| 91 | +def get_inter_annotator_agreement_scores( |
| 92 | + request: Request, |
| 93 | + trainer_export: Annotated[List[UploadFile], File(description="A list of trainer export files to be uploaded")], |
| 94 | + annotator_a_project_id: Annotated[int, Query(description="The project ID from one annotator")], |
| 95 | + annotator_b_project_id: Annotated[int, Query(description="The project ID from another annotator")], |
| 96 | + scope: Annotated[str, Query(enum=[s.value for s in Scope], description="The scope for which the score will be calculated, e.g., per_concept, per_document or per_span")], |
| 97 | + tracking_id: Union[str, None] = Depends(validate_tracking_id), |
| 98 | +) -> StreamingResponse: |
91 | 99 | """ |
92 | 100 | Calculates Inter-Annotator Agreement (IAA) scores between projects done by two annotators. |
93 | 101 |
|
@@ -136,14 +144,18 @@ def get_inter_annotator_agreement_scores(request: Request, |
136 | 144 | return response |
137 | 145 |
|
138 | 146 |
|
139 | | -@router.post("/concat_trainer_exports", |
140 | | - tags=[Tags.Evaluating.name], |
141 | | - response_class=JSONResponse, |
142 | | - dependencies=[Depends(cms_globals.props.current_active_user)], |
143 | | - description="Concatenate multiple trainer export files into a single file for download") |
144 | | -def get_concatenated_trainer_exports(request: Request, |
145 | | - trainer_export: Annotated[List[UploadFile], File(description="A list of trainer export files to be concatenated")], |
146 | | - tracking_id: Union[str, None] = Depends(validate_tracking_id)) -> JSONResponse: |
| 147 | +@router.post( |
| 148 | + "/concat_trainer_exports", |
| 149 | + tags=[Tags.Evaluating.name], |
| 150 | + response_class=JSONResponse, |
| 151 | + dependencies=[Depends(cms_globals.props.current_active_user)], |
| 152 | + description="Concatenate multiple trainer export files into a single file for download", |
| 153 | +) |
| 154 | +def get_concatenated_trainer_exports( |
| 155 | + request: Request, |
| 156 | + trainer_export: Annotated[List[UploadFile], File(description="A list of trainer export files to be concatenated")], |
| 157 | + tracking_id: Union[str, None] = Depends(validate_tracking_id), |
| 158 | +) -> JSONResponse: |
147 | 159 | """ |
148 | 160 | Concatenates multiple trainer export files into a single file. |
149 | 161 |
|
@@ -172,14 +184,18 @@ def get_concatenated_trainer_exports(request: Request, |
172 | 184 | return response |
173 | 185 |
|
174 | 186 |
|
175 | | -@router.post("/annotation-stats", |
176 | | - tags=[Tags.Evaluating.name], |
177 | | - response_class=StreamingResponse, |
178 | | - dependencies=[Depends(cms_globals.props.current_active_user)], |
179 | | - description="Get annotation stats of trainer export files") |
180 | | -def get_annotation_stats(request: Request, |
181 | | - trainer_export: Annotated[List[UploadFile], File(description="One or more trainer export files to be uploaded")], |
182 | | - tracking_id: Union[str, None] = Depends(validate_tracking_id)) -> StreamingResponse: |
| 187 | +@router.post( |
| 188 | + "/annotation-stats", |
| 189 | + tags=[Tags.Evaluating.name], |
| 190 | + response_class=StreamingResponse, |
| 191 | + dependencies=[Depends(cms_globals.props.current_active_user)], |
| 192 | + description="Get annotation stats of trainer export files", |
| 193 | +) |
| 194 | +def get_annotation_stats( |
| 195 | + request: Request, |
| 196 | + trainer_export: Annotated[List[UploadFile], File(description="One or more trainer export files to be uploaded")], |
| 197 | + tracking_id: Union[str, None] = Depends(validate_tracking_id), |
| 198 | +) -> StreamingResponse: |
183 | 199 | """ |
184 | 200 | Gets annotation statistics from the provided trainer export files. |
185 | 201 |
|
|
0 commit comments