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

View File

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