Search code examples
curlibm-cloudspeech-to-text

Watson Speech to Text : How set my username and password on windows 10


Thank you for open this page.

I want to transcribe a lecture meeting's audio files to texts with Speech to Text and get texts in curl.

Maybe I have an elementary error. I read official Bluemix documents, But I couldn't understand them.

I already got my Service credentials. But I couldn't set them.

I tried set them like this.

An example on Bluemix official documents>>

curl -X POST -u {username}:{password}
--header "Content-Type: audio/flac"
--header "Transfer-Encoding: chunked"
--data-binary @{path}audio-file.flac
"https://stream.watsonplatform.net/speech-to-text/api/v1/recognize?continuous=true"

Tried 1>>

curl -X POST -u "\"username\":\"password\""
--header "Content-Type: audio/flac"
--header "Transfer-Encoding: chunked"
--data-binary @{path}audio-file.flac
"https://stream.watsonplatform.net/speech-to-text/api/v1/recognize?continuous=true"

Tried 2>>

curl -X POST -u 'username':'password\'
--header "Content-Type: audio/flac"
--header "Transfer-Encoding: chunked"
--data-binary @{path}audio-file.flac
"https://stream.watsonplatform.net/speech-to-text/api/v1/recognize?continuous=true"

this code has following error and not working.

Warning: Couldn't read data from file "{path}audio-file.flac", Warning: this makes an empty POST. curl: (60) SSL certificate problem: self signed certificate in certificate chain More details here: http://curl.haxx.se/docs/sslcerts.html

Besides I don't know where should I put my audio files and from where should I path to the files. I path to them from terminal's pwd and I put them on my local directory. Is it wrong?

Could you give me your advice?


Solution

  • You need to put the absolute path to your audio file.

    For instance (if the files were in my current directory):

    curl -X POST -u "myusername":"mypassword" --header "Content-Type: audio/flac" --data-binary "@audio-file1.flac" --data-binary "@audio-file2.flac" "https://stream.watsonplatform.net/speech-to-text/api/v1/recognize?timestamps=true&word_alternatives_threshold=0.9&keywords=%22colorado%22%2C%22tornado%22%2C%22tornadoes%22&keywords_threshold=0.5&continuous=true"
    

    Sample Audio Files