Created
February 11, 2023 08:18
-
-
Save ftnext/c60a32087a25146674edc6eb70bc8fb0 to your computer and use it in GitHub Desktop.
シオン・プロジェクトのスパイクとして作ったスクリプト(ESPnetでASRできるか検証)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import soundfile | |
from espnet2.bin.asr_inference import Speech2Text | |
parser = argparse.ArgumentParser() | |
parser.add_argument("audio_file_path") # sayコマンドなどで準備する | |
args = parser.parse_args() | |
speech2text = Speech2Text.from_pretrained("kan-bayashi/csj_asr_train_asr_transformer_raw_char_sp_valid.acc.ave") | |
speech_array, sampling_rate = soundfile.read(args.audio_file_path) | |
nbests = speech2text(speech_array) | |
text, tokens, *_ = nbests[0] | |
print(text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment