
    9i"                         S SK JrJr  S SKrS SKrS SKJr  S SKJ	r	  S SK
JrJr  S SKJr  S SKJr  \R"                  " \R$                  \R&                  S9 " S	 S
\5      5       rg)    )AnyDictN)	Pipelines)
OutputKeys)InputPipeline)	PIPELINES)Tasks)module_namec                      ^  \ rS rSrSrSrU 4S jrS\S\\	\
4   4S jrS\\	\
4   S\\	\
4   4S jrS\\	\
4   S\\	\
4   4S	 jrS
rU =r$ )SSRPipeline   zANS (Acoustic Noise Suppression) Inference Pipeline .

When invoke the class with pipeline.__call__(), it accept only one
parameter:
    inputs(str): the path of wav file
i  c                    > [         TU ]  " SSU0UD6  U R                  R                  5         UR	                  SS5      U l        g)zu
use `model` and `preprocessor` to create a kws pipeline for prediction
Args:
    model: model id on modelscope hub.
modelstream_modeFN )super__init__r   evalgetr   )selfr   kwargs	__class__s      g/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/modelscope/pipelines/audio/ssr_pipeline.pyr   SSRPipeline.__init__   s;     	/u//

!::mU;    inputsreturnc                     U$ Nr   )r   r   preprocess_paramss      r   
preprocessSSRPipeline.preprocess%       r   c                     [         R                  " 5          U R                  U5      nS S S 5        WS-  n[        R                  " US5      R                  5       n[        R                  U0$ ! , (       d  f       NJ= f)Ng      @int16)torchno_gradr   nparraytobytesr   
OUTPUT_PCM)r   r   forward_paramsoutputss       r   forwardSSRPipeline.forward(   sZ    ]]_jj(G 6((7G,446%%w//	 _s   A,,
A:c                     U$ r    r   )r   r   r   s      r   postprocessSSRPipeline.postprocess0   r$   r   )r   )__name__
__module____qualname____firstlineno____doc__SAMPLE_RATEr   r   r   strr   r"   r/   r2   __static_attributes____classcell__)r   s   @r   r   r      s{     K< S#X 0d38n 0%)#s(^0$sCx. tCH~  r   r   )typingr   r   numpyr)   r'   modelscope.metainfor   modelscope.outputsr   modelscope.pipelines.baser   r   modelscope.pipelines.builderr	   modelscope.utils.constantr
   register_modulespeech_super_resolution!speech_super_resolution_inferencer   r   r   r   <module>rG      sW       ) ) 5 2 + 	!!;;=( =r   