class_docstr: ```
  predicts text classes
  ```
class_docstr_tok: ["``","`","predicts","text","classes","``","`"]
docstr: ```
  
  Makes predictions for a list of strings where each string is a document
  or text snippet.
  If return_proba is True, returns probabilities of each class.
  Args:
    texts(str|list): For text classification, texts should be either a str or
                     a list of str.
                     For sentence pair classification, texts should be either
                     a tuple of form (str, str) or list of tuples.
                     A single tuple of the form (str, str) is automatically treated as sentence pair classification, so
                     please refrain from using tuples for text classification tasks.
    return_proba(bool): If True, return probabilities instead of predicted class labels
    verbose(int): verbosity: 0 (silent), 1 (progress bar), 2 (single line)
  ```
docstr_tok: ["``","`","Makes","predictions","for","a","list","of","strings","where","each","string","is","a","document","or","text","snippet",".","If","return_proba","is","True",",","returns","probabilities","of","each","class",".","Args",":","texts","(","str|list",")",":","For","text","classification",",","texts","should","be","either","a","str","or","a","list","of","str",".","For","sentence","pair","classification",",","texts","should","be","either","a","tuple","of","form","(","str",",","str",")","or","list","of","tuples",".","A","single","tuple","of","the","form","(","str",",","str",")","is","automatically","treated","as","sentence","pair","classification",",","so","please","refrain","from","using","tuples","for","text","classification","tasks",".","return_proba","(","bool",")",":","If","True",",","return","probabilities","instead","of","predicted","class","labels","verbose","(","int",")",":","verbosity",":","0","(","silent",")",",","1","(","progress","bar",")",",","2","(","single","line",")","``","`"]
code: def predict(self, texts, return_proba=False, verbose=0):
      """
      ```
  
      Makes predictions for a list of strings where each string is a document
      or text snippet.
      If return_proba is True, returns probabilities of each class.
      Args:
        texts(str|list): For text classification, texts should be either a str or
                         a list of str.
                         For sentence pair classification, texts should be either
                         a tuple of form (str, str) or list of tuples.
                         A single tuple of the form (str, str) is automatically treated as sentence pair classification, so
                         please refrain from using tuples for text classification tasks.
        return_proba(bool): If True, return probabilities instead of predicted class labels
        verbose(int): verbosity: 0 (silent), 1 (progress bar), 2 (single line)
      ```
      """
  
      is_array, is_pair = detect_text_format(texts)
      if not is_array:
          texts = [texts]
  
      classification, multilabel = U.is_classifier(self.model)
  
      # get predictions
      if U.is_huggingface(model=self.model):
          tseq = self.preproc.preprocess_test(texts, verbose=0)
          tseq.batch_size = self.batch_size
          tfd = tseq.to_tfdataset(train=False)
          preds = self.model.predict(tfd, verbose=verbose)
          if hasattr(
              preds, "logits"
          ):  # dep_fix: breaking change - also needed for LongFormer
              # if type(preds).__name__ == 'TFSequenceClassifierOutput': # dep_fix: undocumented breaking change in transformers==4.0.0
              # REFERENCE: https://discuss.huggingface.co/t/new-model-output-types/195
              preds = preds.logits
  
          # dep_fix: transformers in TF 2.2.0 returns a tuple insead of NumPy array for some reason
          if isinstance(preds, tuple) and len(preds) == 1:
              preds = preds[0]
      else:
          texts = self.preproc.preprocess(texts)
          preds = self.model.predict(
              texts, batch_size=self.batch_size, verbose=verbose
          )
  
      # process predictions
      if U.is_huggingface(model=self.model):
          # convert logits to probabilities for Hugging Face models
          if multilabel and self.c:
              preds = keras.activations.sigmoid(
                  tf.convert_to_tensor(preds)
              ).numpy()
          elif self.c:
              preds = keras.activations.softmax(
                  tf.convert_to_tensor(preds)
              ).numpy()
          else:
              preds = np.squeeze(preds)
              if len(preds.shape) == 0:
                  preds = np.expand_dims(preds, -1)
      result = (
          preds
          if return_proba or multilabel or not self.c
          else [self.c[np.argmax(pred)] for pred in preds]
      )
      if multilabel and not return_proba:
          result = [list(zip(self.c, r)) for r in result]
      if not is_array:
          return result[0]
      else:
          return result
  
file_path: ktrain/ktrain/text/predictor.py
imports: from ..None import utils
  from ..imports import *
  from ..predictor import Predictor
  from .preprocessor import TextPreprocessor, TransformersPreprocessor, detect_text_format
label_desc: Use image node_id 3 for calling the TextPredictor obj's underlying member method code with example usage: obj.predict(texts, return_proba, verbose) and returns: result, result