|
|
@ -12,6 +12,7 @@
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
# limitations under the License.
|
|
|
|
import argparse
|
|
|
|
import argparse
|
|
|
|
|
|
|
|
import io
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
import sys
|
|
|
|
import time
|
|
|
|
import time
|
|
|
@ -229,6 +230,8 @@ class ASRExecutor(BaseExecutor):
|
|
|
|
audio_file = input
|
|
|
|
audio_file = input
|
|
|
|
if isinstance(audio_file, (str, os.PathLike)):
|
|
|
|
if isinstance(audio_file, (str, os.PathLike)):
|
|
|
|
logger.debug("Preprocess audio_file:" + audio_file)
|
|
|
|
logger.debug("Preprocess audio_file:" + audio_file)
|
|
|
|
|
|
|
|
elif isinstance(audio_file, io.BytesIO):
|
|
|
|
|
|
|
|
audio_file.seek(0)
|
|
|
|
|
|
|
|
|
|
|
|
# Get the object for feature extraction
|
|
|
|
# Get the object for feature extraction
|
|
|
|
if "deepspeech2" in model_type or "conformer" in model_type or "transformer" in model_type:
|
|
|
|
if "deepspeech2" in model_type or "conformer" in model_type or "transformer" in model_type:
|
|
|
@ -352,6 +355,8 @@ class ASRExecutor(BaseExecutor):
|
|
|
|
if not os.path.isfile(audio_file):
|
|
|
|
if not os.path.isfile(audio_file):
|
|
|
|
logger.error("Please input the right audio file path")
|
|
|
|
logger.error("Please input the right audio file path")
|
|
|
|
return False
|
|
|
|
return False
|
|
|
|
|
|
|
|
elif isinstance(audio_file, io.BytesIO):
|
|
|
|
|
|
|
|
audio_file.seek(0)
|
|
|
|
|
|
|
|
|
|
|
|
logger.debug("checking the audio file format......")
|
|
|
|
logger.debug("checking the audio file format......")
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|