docstr: The function takes in a list of strings and returns a list of predictions
  
  Args:
    text (Union[List[str], str]): The text to be classified.
    as_argilla_records (bool): If True, the prediction will be returned as an Argilla record. If
  False, the prediction will be returned as a string. Defaults to True
  
  Returns:
    A list of predictions
docstr_tok: ["The","function","takes","in","a","list","of","strings","and","returns","a","list","of","predictions","Args",":","text","(","Union","[","List","[","str","]",",","str","]",")",":","The","text","to","be","classified",".","as_argilla_records","(","bool",")",":","If","True",",","the","prediction","will","be","returned","as","an","Argilla","record",".","If","False",",","the","prediction","will","be","returned","as","a","string",".","Defaults","to","True","Returns",":","A","list","of","predictions"]
code: def predict(
      self,
      text: Union[List[str], str],
      as_argilla_records: bool = True,
      **kwargs,
  ):
      """
      The function takes in a list of strings and returns a list of predictions
  
      Args:
        text (Union[List[str], str]): The text to be classified.
        as_argilla_records (bool): If True, the prediction will be returned as an Argilla record. If
      False, the prediction will be returned as a string. Defaults to True
  
      Returns:
        A list of predictions
      """
      if self.trainer_pipeline is None:
          self._logger.warning("Using model without fine-tuning.")
          self.init_model(new=False)
          self.init_pipeline()
  
      str_input = False
      if isinstance(text, str):
          text = [text]
          str_input = True
  
      predictions = self.trainer_pipeline(text, **kwargs)
  
      if as_argilla_records:
          formatted_prediction = []
  
          for val, pred in zip(text, predictions):
              if self._record_class == TextClassificationRecord:
                  formatted_prediction.append(
                      self._record_class(
                          text=val,
                          prediction=[
                              (entry["label"], entry["score"])
                              for entry in pred
                          ],
                          multi_label=self._multi_label,
                      )
                  )
              elif self._record_class == TokenClassificationRecord:
                  _pred = [
                      (
                          value["entity_group"],
                          value["start"],
                          value["end"],
                      )
                      for value in pred
                  ]
                  encoding = self.trainer_pipeline.tokenizer(val)
                  word_ids = sorted(set(encoding.word_ids()) - {None})
                  tokens = []
                  for word_id in word_ids:
                      char_span = encoding.word_to_chars(word_id)
                      tokens.append(
                          val[char_span.start : char_span.end]
                          .lstrip()
                          .rstrip()
                      )
                  formatted_prediction.append(
                      self._record_class(
                          text=val,
                          tokens=tokens,
                          prediction=_pred,
                      )
                  )
  
              else:
                  raise NotImplementedError(
                      "This is not implemented yet."
                  )
      else:
          formatted_prediction = predictions
  
      if str_input:
          formatted_prediction = formatted_prediction[0]
  
      return formatted_prediction
  
file_path: argilla/src/argilla/training/transformers.py
imports: import logging
  from typing import List, Union
  from datasets import DatasetDict
  from argilla.client.models import TextClassificationRecord, TokenClassificationRecord
  from argilla.training.base import ArgillaTrainerSkeleton
  from argilla.training.utils import _apply_column_mapping, filter_allowed_args, get_default_args
  from argilla.utils.dependency import require_dependencies
label_desc: Use image node_id 10 for calling the ArgillaTransformersTrainer obj's underlying member method code with example usage: obj.predict(text, as_argilla_records) and returns: formatted_prediction