i have tried the pre-trained model on a single file, but i need to try it on a set of audio files an save the results (text of each audio file)
in exel file …
This is a sample python script that i wrote to read wav files from a folder and write the output in a text file
You can run the script in the below way where tmp is the folder where your audio files are
Hope it helps
python SnToTxt.py models2/output_graph.pb models2/alphabet.txt tmp/
from deepspeech.model import Model
import scipy.io.wavfile as wav
import sys
import os as os
ds = Model(sys.argv[1], 26, 9, sys.argv[2], 500)
pathToAudio = sys.argv[3]
audio_files = os.listdir(pathToAudio)
for eachfile in audio_files :
if eachfile.endswith(".wav"):
file_Path = pathToAudio + eachfile
print("File to be read is ", file_Path)
fs, audio = wav.read(file_Path)
processed_data = ds.stt(audio, fs)
print("Processed Data : " , processed_data)
with open('output.txt', 'a') as f:
f.write(processed_data)
f.write("\r\n")
f.write("\r\n")`Preformatted text`
In the above solution, from deepspeech.model import Model is used. This is using the pretrained model provided by Deepspeech right?
How can I use the model I trained to produce transcripts for set of audio files?