Update cmd-asr.py

slice files order by name
This commit is contained in:
zhangheng 2024-02-03 15:43:15 +08:00 committed by GitHub
parent 01a4684746
commit fc218079ea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -25,7 +25,9 @@ model = AutoModel(model=path_asr, model_revision="v2.0.4",
opt=[]
for name in os.listdir(dir):
file_names = os.listdir(dir)
file_names.sort()
for name in file_names:
try:
text = model.generate(input="%s/%s"%(dir,name))[0]["text"]
opt.append("%s/%s|%s|ZH|%s"%(dir,name,opt_name,text))