


from ...processing_utils import ProcessorMixin






class _lowerCamelCase(		_a     ):
       lowercase_				:			str									=    ["""image_processor""", """feature_extractor"""]
       lowercase_				:			int									=    """TvltImageProcessor"""
       lowercase_				:			Optional[int]									=    """TvltFeatureExtractor"""
       def __init__(      self,   lowerCamelCase,   lowerCamelCase) ->     List[Any]:




           """simple docstring"""

           super().__init__(image_processor=lowerCamelCase,   feature_extractor=lowerCamelCase)

           _lowercase :							List[str]   	=	image_processor
           _lowercase :							str   	=	feature_extractor
       def __call__(      self,   lowerCamelCase=None,   lowerCamelCase=None,   lowerCamelCase=None,   lowerCamelCase=None,   lowerCamelCase=False,   lowerCamelCase=False,   *lowerCamelCase,   **lowerCamelCase,   ) ->     Union[str, Any]:




           """simple docstring"""

           if images is None and audio is None:
               raise ValueError('You need to specify either an `images` or `audio` input to process.')

           _lowercase :							int   	=	None
           if images is not None:
               _lowercase :							str   	=	self.image_processor(lowerCamelCase,   mask_pixel=lowerCamelCase,   *lowerCamelCase,   **lowerCamelCase)
           if images_mixed is not None:
               _lowercase :							Optional[int]   	=	self.image_processor(lowerCamelCase,   is_mixed=lowerCamelCase,   *lowerCamelCase,   **lowerCamelCase)
           if audio is not None:
               _lowercase :							str   	=	self.feature_extractor(
                   lowerCamelCase,   *lowerCamelCase,   sampling_rate=lowerCamelCase,   mask_audio=lowerCamelCase,   **lowerCamelCase)

           _lowercase :							List[Any]   	=	{}
           if audio is not None:
               output_dict.update(lowerCamelCase)
           if images is not None:
               output_dict.update(lowerCamelCase)
           if images_mixed_dict is not None:
               output_dict.update(lowerCamelCase)
           return output_dict




       @property
       def     UpperCamelCase  (      self) ->     str:




           """simple docstring"""

           _lowercase :							Tuple   	=	self.image_processor.model_input_names
           _lowercase :							Any   	=	self.feature_extractor.model_input_names
           return list(dict.fromkeys(image_processor_input_names + feature_extractor_input_names))






from typing import Dict

from .base import GenericTensor, Pipeline






class _lowerCamelCase(		_a     ):
       def     UpperCamelCase  (      self,   lowerCamelCase=None,   lowerCamelCase=None,   lowerCamelCase=None,   **lowerCamelCase) ->     int:




           """simple docstring"""

           if tokenize_kwargs is None:
               _lowercase :							Any   	=	{}

           if truncation is not None:
               if "truncation" in tokenize_kwargs:
                   raise ValueError(
                       'truncation parameter defined twice (given as keyword argument as well as in tokenize_kwargs)')
               _lowercase :							List[Any]   	=	truncation

           _lowercase :							Optional[Any]   	=	tokenize_kwargs

           _lowercase :							Tuple   	=	{}
           if return_tensors is not None:
               _lowercase :							Union[str, Any]   	=	return_tensors

           return preprocess_params, {}, postprocess_params
       def     UpperCamelCase  (      self,   lowerCamelCase,   **lowerCamelCase) ->     Dict[str, GenericTensor]:




           """simple docstring"""

           _lowercase :							Optional[Any]   	=	self.framework
           _lowercase :							Dict   	=	self.tokenizer(lowerCamelCase,   return_tensors=lowerCamelCase,   **lowerCamelCase)
           return model_inputs
       def     UpperCamelCase  (      self,   lowerCamelCase) ->     Optional[Any]:




           """simple docstring"""

           _lowercase :							str   	=	self.model(**lowerCamelCase)
           return model_outputs
       def     UpperCamelCase  (      self,   lowerCamelCase,   lowerCamelCase=False) ->     Dict:




           """simple docstring"""

           if return_tensors:
               return model_outputs[0]
           if self.framework == "pt":
               return model_outputs[0].tolist()
           elif self.framework == "tf":
               return model_outputs[0].numpy().tolist()




       def __call__(      self,   *lowerCamelCase,   **lowerCamelCase) ->     Union[str, Any]:




           """simple docstring"""

           return super().__call__(*lowerCamelCase,   **lowerCamelCase)


