code: def to_classification(results, id2label):
      """Converts the Transformers classification results to FiftyOne format.
  
      Args:
          results: Transformers classification results
          id2label: Transformers ID to label mapping
  
      Returns:
          a single or list of :class:`fiftyone.core.labels.Classification`
      """
      logits = results.logits
      predicted_labels = logits.argmax(-1)
  
      logits = logits.cpu().numpy()
      label_classes = [id2label[int(i)] for i in predicted_labels]
  
      odds = np.exp(logits)
      confidences = np.max(odds, axis=1) / np.sum(odds, axis=1)
  
      if logits.shape[0] == 1:
          return fol.Classification(
              label=label_classes[0],
              confidence=confidences[0],
              logits=logits[0],
          )
  
      return [
          fol.Classification(
              label=label_classes[i],
              confidence=confidences[i],
              logits=logits[i],
          )
          for i in range(logits.shape[0])
      ]
  
imports: import numpy
  from fiftyone.core.config import Config
  import fiftyone.core.labels
  from fiftyone.core.models import Model, EmbeddingsMixin
  import fiftyone.core.utils
label_desc: Use image node_id 4 for calling a global function with example usage: to_classification(results, id2label) and returns: unknown, fol