For any queries you can reach us at / WhatsApp us: +919158876092

Speech to Text using Wit.Ai in Python

Speech to Text using Wit.Ai

Speech to Text using Wit.Ai is a natural language interface for applications ability of turning sentences into organized data. It is also pretty accurate for speech recognition and audio transcription.

Follow the below steps to use

  1. Open in web browser.
  2. Login using your GitHub or Facebook account. if you dont have one, create one.
  3. Click on the New App button to create new app.
  4. In Settings tab, you will find Server Access Token and Client Access Token. Copy it, as it will be needed for authentication in the python script.

Run the following command to install wit packages.

pip3 install wit

Wit will be successfully be installed.

Speech to text using Wit.Ai (Audio file)

from wit import Wit

access_token = "Your access token"
client = Wit(access_token)

resp = None
with open('avatar.wav', 'rb') as f:
  resp = client.speech(f, None, {'Content-Type': 'audio/wav'})
print(f'Yay, got response: {str(resp)}')