For the input, do the predictions and return them. Args: input (a pandas dataframe): The data on which to do the predictions. There will be one prediction per row in the dataframe
(cls, texts)
| 70 | |
| 71 | @classmethod |
| 72 | def predict_batch(cls, texts): |
| 73 | """For the input, do the predictions and return them. |
| 74 | Args: |
| 75 | input (a pandas dataframe): The data on which to do the predictions. There will be |
| 76 | one prediction per row in the dataframe""" |
| 77 | predictor_model = cls.get_predictor_model() |
| 78 | output_labels_count = int( |
| 79 | os.environ.get( |
| 80 | "OUTPUT_LABELS_COUNT", len(predictor_model.learner.data.labels) |
| 81 | ) |
| 82 | ) |
| 83 | |
| 84 | print("output_labels_count", output_labels_count) |
| 85 | |
| 86 | predictions = predictor_model.predict_batch(texts) |
| 87 | return cls.process_batch_results( |
| 88 | texts, predictions, labels_count=output_labels_count |
| 89 | ) |
| 90 | |
| 91 | @classmethod |
| 92 | def searching_all_files(cls, directory: Path): |
no test coverage detected