class_docstr: Task for emotion detection.
  
  Attributes:
      model:
          1. Model name
          2. Model name on Backprop's emotion endpoint
          3. Model object that implements the emotion task
      local (optional): Run locally. Defaults to False
      api_key (optional): Backprop API key for non-local inference
      device (optional): Device to run inference on. Defaults to "cuda" if available.
docstr: Perform emotion detection on input text.
  
  Args:
      text: string or list of strings to detect emotion from
          keep this under a few sentences for best performance.
  
  Returns:
      Emotion string or list of emotion strings.
docstr_tok: ["Perform","emotion","detection","on","input","text",".","Args",":","text",":","string","or","list","of","strings","to","detect","emotion","from","keep","this","under","a","few","sentences","for","best","performance",".","Returns",":","Emotion","string","or","list","of","emotion","strings","."]
code: def __call__(self, text: Union[str, List[str]]):
      """Perform emotion detection on input text.
  
      Args:
          text: string or list of strings to detect emotion from
              keep this under a few sentences for best performance.
  
      Returns:
          Emotion string or list of emotion strings.
      """
      task_input = {"text": text}
      if self.local:
          return self.model(task_input, task="emotion")
      else:
          task_input["model"] = self.model
  
          res = requests.post(
              "https://api.backprop.co/emotion",
              json=task_input,
              headers={"x-api-key": self.api_key},
          ).json()
  
          if res.get("message"):
              raise Exception(
                  f"Failed to make API request: {res['message']}"
              )
  
          return res["emotion"]
  
file_path: backprop/backprop/tasks/emotion.py
imports: from typing import List, Tuple, Union, Dict
  from .base import Task
  from backprop.models import BaseModel, AutoModel
  from transformers.optimization import Adafactor
  from backprop.utils.datasets import TextToTextDataset
  import requests
label_desc: Use image node_id 3 for calling the Emotion obj's underlying member method code with example usage: obj.__call__(text) and returns: self, res