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
      """
      from datasets import Dataset
  
      if self.trainer_model is None:
          self._logger.warning("Using model without fine-tuning.")
          self.init_model()
  
      str_input = False
      if isinstance(text, str):
          text = [text]
          str_input = True
  
      entities_list = self.trainer_model.predict(text, **kwargs)
  
      if as_argilla_records:
          formatted_prediction = []
  
          for sentence, entities in zip(text, entities_list):
              predictions = [
                  (
                      entity["label"],
                      entity["char_start_index"],
                      entity["char_end_index"],
                      entity["score"],
                  )
                  for entity in entities
              ]
              dataset = Dataset.from_dict({"tokens": text})
              encoding = self.trainer_model.tokenizer(
                  {"tokens": dataset["tokens"]},
                  return_batch_encoding=True,
              )["batch_encoding"]
              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(
                      sentence[char_span.start : char_span.end]
                      .lstrip()
                      .rstrip()
                  )
              formatted_prediction.append(
                  self._record_class(
                      text=sentence,
                      tokens=tokens,
                      prediction=predictions,
                  )
              )
      else:
          formatted_prediction = entities_list
  
      if str_input:
          return formatted_prediction[0]
      return formatted_prediction
  
file_path: argilla/src/argilla/training/span_marker.py
imports: import logging
  from typing import List, Union
  from datasets import DatasetDict
  from argilla.client.models import TokenClassificationRecord
  from argilla.training.base import ArgillaTrainerSkeleton
  from argilla.training.utils import filter_allowed_args, get_default_args
  from argilla.utils.dependency import require_dependencies
label_desc: Use image node_id 7 for calling the ArgillaSpanMarkerTrainer obj's underlying member method code with example usage: obj.predict(text, as_argilla_records) and returns: formatted_prediction, formatted_prediction