


'''simple docstring'''






from typing import TYPE_CHECKING

from ..utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_torch_available,
)


_A      =     {
    'agents': ['Agent', 'AzureOpenAiAgent', 'HfAgent', 'LocalAgent', 'OpenAiAgent'],
    'base': ['PipelineTool', 'RemoteTool', 'Tool', 'launch_gradio_demo', 'load_tool'],
}

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      _A      =     ['DocumentQuestionAnsweringTool']
      _A      =     ['ImageCaptioningTool']
      _A      =     ['ImageQuestionAnsweringTool']
      _A      =     ['ImageSegmentationTool']
      _A      =     ['SpeechToTextTool']
      _A      =     ['TextClassificationTool']
      _A      =     ['TextQuestionAnsweringTool']
      _A      =     ['TextSummarizationTool']
      _A      =     ['TextToSpeechTool']
      _A      =     ['TranslationTool']

if TYPE_CHECKING:
      from .agents import Agent, AzureOpenAiAgent, HfAgent, LocalAgent, OpenAiAgent
      from .base import PipelineTool, RemoteTool, Tool, launch_gradio_demo, load_tool

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .document_question_answering import DocumentQuestionAnsweringTool
            from .image_captioning import ImageCaptioningTool
            from .image_question_answering import ImageQuestionAnsweringTool
            from .image_segmentation import ImageSegmentationTool
            from .speech_to_text import SpeechToTextTool
            from .text_classification import TextClassificationTool
            from .text_question_answering import TextQuestionAnsweringTool
            from .text_summarization import TextSummarizationTool
            from .text_to_speech import TextToSpeechTool
            from .translation import TranslationTool
else:
      import sys

      _A      =     _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)






'''simple docstring'''






import abc
import copy
import dataclasses
from dataclasses import dataclass
from typing import ClassVar, Dict, Type, TypeVar

from ..features import Features


_A      =     TypeVar("""T""", bound="""TaskTemplate""")






@dataclass(frozen=snake_case		)
class      SCREAMING_SNAKE_CASE_	( abc.ABC		):
			# `task` is not a ClassVar since we want it to be part of the `asdict` output for JSON serialization
			__a					:      str
			__a					:      ClassVar[Features]
			__a					:      ClassVar[Features]




			def 			_snake_case   (      self					,      lowercase       )			->						T:


								'''simple docstring'''






								return copy.deepcopy(self       )




			@property
			def 			_snake_case   (      self       )			->						Features:


								'''simple docstring'''






								return Features(**self.input_schema					,      **self.label_schema       )




			@property
			@abc.abstractmethod
			def 			_snake_case   (      self       )			->						Dict[str, str]:


								'''simple docstring'''






								raise NotImplementedError




			@classmethod
			def 			_snake_case   (      cls					,      lowercase       )			->						T:


								'''simple docstring'''






								__SCREAMING_SNAKE_CASE					:							Union[str, Any]			   = {f.name for f in dataclasses.fields(cls       )}
								return cls(**{k: v for k, v in template_dict.items() if k in field_names}       )


