How to convert audio to subtitle (text) with Python?

For example, you can use “Speech_Recognition” for your certificate using Python. For example, you can use “Speech_Recognition” for your certificate using Python. For example, you can use “Speech_Recognition” for your certificate using Python instead of using “username+ PWD”

Using the curl command, you can use the URL to convert audio to text.

curl -X POST -u "apikey:{apikey}" --header "Content-Type: audio/flac" --data-binary @{path_to_file}audio-file.flac "{url}/v1/recognize"

To do this, you need to use the curl command to do something that you want to do. To do this, you need to do something that you want to do. To do this, you need to do something that you want to do.

import requests

headers = {
    'Content-Type': 'audio/flac',
}

data = open('audio-file.flac', 'rb').read()
r = requests.post('https://gateway-wdc.watsonplatform.net/speech-to-text/api/v1/recognize', headers=headers, data=data, auth=('apikey', '***************************'))
print(r.text)

Test effect:

This doesn’t even need to pack well….. It’s OK to request the interface directly. Finally, attach the original version of the code to call the interface implementation method:

import speech_recognition as sr
import requests

harvard = sr.AudioFile('23.wav')
r = sr.Recognizer()
with harvard as source:
    audio = r.record(source)
print(type(audio))

IBM_USERNAME = '************************'
IBM_PASSWORD = '************************'

text = r.recognize_google(audio, username= IBM_USERNAME, password = IBM_PASSWORD, language = 'zh-CN')
print(text)

 
 

Read More: