Speech to text transcription in real-time using IBM Watson
Project description
Speech to text transcription from your microphone in real-time using IBM Watson.
Installing
This project depends on PortAudio - a free, cross-platform, open-source, audio I/O library. Install it first.
Prepare your credentials from IBM Watson (free trials are available):
Visit the IBM Watson projects page.
Choose your project.
Copy the credentials to credentials.json somewhere on your computer.
pip install watson-streaming and you are ready to go!
Using from the command line
watson-streaming path/to/credentials.json # And start talking
Using as a library
from watson_streaming import transcribe
# Write whatever you want in your callback function (expecting a dict)
def example_callback(data):
if 'results' in data:
transcript = data['results'][0]['alternatives'][0]['transcript']
print(transcript)
# Provide a dictionary of Watson input and output features.
# For example
settings = {
'inactivity_timeout': -1, # Don't kill me after 30 seconds
'interim_results': True,
}
# You can't ask for a simpler API than this!
transcribe(example_callback, settings, 'credentials.json')
Custom audio source
By default, the audio from the computer sound card is sent to IBM Watson for transcription. If you want to send audio from another source (like a file, socket, etc.) use the audio_gen argument of the transcribe function. This should be a generator that yields audio samples, currently in 44100 Hz sample rate. See examples/audio_from_file.py.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for watson_streaming-0.0.5-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e96ebc5b4c678e79841d58c24e3dd94a928e2d078ca03b6cbf8e311d5d44c5c5 |
|
MD5 | 871318e5f50b6f37dc783b1002da94f3 |
|
BLAKE2b-256 | 39d6ebfe8649dfc4adfd8a583fdbaf6545706a09fb3492529d1f5f5f9b4e59a3 |