def METHOD_NAME(self, input: Union[str, np.ndarray]) -> torch.Tensor:
    if isinstance(input, str):
        file_bytes = File.read(input)
        data, fs = sf.read(io.BytesIO(file_bytes), dtype='float32')
        if len(data.shape) == 2:
            data = data[:, 0]
        data = torch.from_numpy(data).unsqueeze(0)
        if fs != self.model_config['sample_rate']:
            logger.warning(
                'The sample rate of audio is not %d, resample it.'
                % self.model_config['sample_rate'])
            data, fs = torchaudio.sox_effects.apply_effects_tensor(
                data,
                fs,
                effects=[['rate',
                          str(self.model_config['sample_rate'])]])
    elif isinstance(input, np.ndarray):
        if input.dtype in ['int16', 'int32', 'int64']:
            input = (input / (1 << 15)).astype('float32')
        else:
            input = input.astype('float32')
        data = torch.from_numpy(input)
        if len(data.shape) == 1:
            data = data.unsqueeze(0)
    else:
        raise ValueError(
            'modelscope error: The input type is restricted to audio file address and numpy array.'
        )
    return data