Remove sample rate parameter usage from Python binding

This commit is contained in:
Reuben Morais 2019-10-09 16:43:14 +02:00
parent abb11f040d
commit 97bab38a7e
2 changed files with 4 additions and 14 deletions

View File

@ -75,9 +75,6 @@ class Model(object):
:param aBufferSize: The number of samples in the audio signal.
:type aBufferSize: int
:param aSampleRate: The sample-rate of the audio signal.
:type aSampleRate: int
:return: The STT result.
:type: str
"""
@ -93,28 +90,21 @@ class Model(object):
:param aBufferSize: The number of samples in the audio signal.
:type aBufferSize: int
:param aSampleRate: The sample-rate of the audio signal.
:type aSampleRate: int
:return: Outputs a struct of individual letters along with their timing information.
:type: :func:`Metadata`
"""
return deepspeech.impl.SpeechToTextWithMetadata(self._impl, *args, **kwargs)
def createStream(self, sample_rate=16000):
def createStream(self):
"""
Create a new streaming inference state. The streaming state returned
by this function can then be passed to :func:`feedAudioContent()` and :func:`finishStream()`.
:param aSampleRate: The sample-rate of the audio signal.
:type aSampleRate: int
:return: Object holding the stream
:throws: RuntimeError on error
"""
status, ctx = deepspeech.impl.CreateStream(self._impl,
aSampleRate=sample_rate)
status, ctx = deepspeech.impl.CreateStream(self._impl)
if status != 0:
raise RuntimeError("CreateStream failed with error code {}".format(status))
return ctx

View File

@ -102,9 +102,9 @@ def main():
print('Running inference.', file=sys.stderr)
inference_start = timer()
if args.extended:
print(metadata_to_string(ds.sttWithMetadata(audio, fs)))
print(metadata_to_string(ds.sttWithMetadata(audio)))
else:
print(ds.stt(audio, fs))
print(ds.stt(audio))
inference_end = timer() - inference_start
print('Inference took %0.3fs for %0.3fs audio file.' % (inference_end, audio_length), file=sys.stderr)