@@ -792,11 +792,9 @@ def predict(
792
792
for i in range (0 , len (other_predictions ), batch_size )
793
793
]
794
794
795
- agg_response = {
796
- MODEL_RUN_ID_KEY : model_run_id ,
797
- PREDICTIONS_PROCESSED_KEY : 0 ,
798
- PREDICTIONS_IGNORED_KEY : 0 ,
799
- }
795
+ errors = []
796
+ predictions_processed = 0
797
+ predictions_ignored = 0
800
798
801
799
tqdm_batches = self .tqdm_bar (batches )
802
800
@@ -807,29 +805,27 @@ def predict(
807
805
)
808
806
response = self .make_request (batch_payload , endpoint )
809
807
if STATUS_CODE_KEY in response :
810
- agg_response [ ERRORS_KEY ] = response
808
+ errors . append ( response )
811
809
else :
812
- agg_response [PREDICTIONS_PROCESSED_KEY ] += response [
813
- PREDICTIONS_PROCESSED_KEY
814
- ]
815
- agg_response [PREDICTIONS_IGNORED_KEY ] += response [
816
- PREDICTIONS_IGNORED_KEY
817
- ]
810
+ predictions_processed += response [PREDICTIONS_PROCESSED_KEY ]
811
+ predictions_ignored += response [PREDICTIONS_IGNORED_KEY ]
818
812
819
813
for s_batch in s_batches :
820
814
payload = construct_segmentation_payload (s_batch , update )
821
815
response = self .make_request (payload , endpoint )
822
816
# pbar.update(1)
823
817
if STATUS_CODE_KEY in response :
824
- agg_response [ ERRORS_KEY ] = response
818
+ errors . append ( response )
825
819
else :
826
- agg_response [PREDICTIONS_PROCESSED_KEY ] += response [
827
- PREDICTIONS_PROCESSED_KEY
828
- ]
829
- agg_response [PREDICTIONS_IGNORED_KEY ] += response [
830
- PREDICTIONS_IGNORED_KEY
831
- ]
820
+ predictions_processed += response [PREDICTIONS_PROCESSED_KEY ]
821
+ predictions_ignored += response [PREDICTIONS_IGNORED_KEY ]
832
822
823
+ agg_response = {
824
+ MODEL_RUN_ID_KEY : model_run_id ,
825
+ PREDICTIONS_PROCESSED_KEY : predictions_ignored ,
826
+ PREDICTIONS_IGNORED_KEY : predictions_processed ,
827
+ ERRORS_KEY : errors ,
828
+ }
833
829
return agg_response
834
830
835
831
def commit_model_run (
0 commit comments