0
votes

I have created IBM Speech to Text service. Then I have performed the trial call using the following IBM instructions:

Try an API call

Call the POST /v1/recognize method to request a basic transcription of a FLAC audio file with no additional request parameters.

First, download the sample audio file audio-file.flac.

Then, issue the following command to call the service's /v1/recognize method for basic transcription with no parameters. The example uses the Content-Type header to indicate the type of the audio, audio/flac. The example uses the default language model, en-US_BroadbandModel, for transcription. Be sure to modify {path_to_file} to specify the location of the audio-file.flac file.

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

The service returns the following transcription results:

 {
   "results": [
     {
       "alternatives": [
         {
           "confidence": 0.8691191673278809,
           "transcript": "several tornadoes touch down as a line of severe thunderstorms swept through colorado on sunday"
         }
       ],
       "final": true
     }
   ],
   "result_index": 0
 }

I have tried execute this substituting my STT service credentials, but I received error message instead of transcript result:

<HTML><HEAD><TITLE>Error</TITLE></HEAD><BODY>
An error occurred while processing your request.<p>
Reference&#32;&#35;179&#46;24f01502&#46;1545478256&#46;101ee90d
</BODY></HTML>

I have tried different {path_to_file} variants - using slashes /, backslashes \ and double backslashes \ \ but all of them returned the same error. What's wrong with my request or my STT service?

1
Do you keep the "@" at the start of your path? Have you tried to execute the curl command from the same directory the file is located?briadeus
Both answers: yes. I have tried this command: curl -X POST -u "apikey:q25...JVC" --header "Content-Type: audio/flac" --data-binary @audio-file.flac "gateway-lon.watsonplatform.net/speech-to-text/api/v1/recognize" and its variations with @C:\UnityProjects\vr-speech-sandbox-vive-master_Work\audio-file.flac @C:/UnityProjects/vr-speech-sandbox-vive-master/_Work/audio-file.flac @C:\\UnityProjects\\vr-speech-sandbox-vive-master\_Work\\audio-file.flac All these variants gave the same error.Yana
Yana your apikey can be used to get an access_token and then call the service with that. Take a look at this page console.bluemix.net/docs/services/watson/…. It shows the process to do a Discovery API call but it's the same for Speech to TextGerman Attanasio
If you use one of the SDKs like Node.js or Python. then all this is done by the SDKGerman Attanasio

1 Answers

0
votes

Check the location of your service - this error occures when you mix up the service urls. For example creating the service in Frankfurt
enter image description here
with this API URL https://stream-fra.watsonplatform.net/speech-to-text/api/v1/recognize and calling the service using the London location gateway-lon

curl -X POST \
-u "apikey:APIKEY" \
--header "Content-Type: audio/flac" \
--data-binary @audio-file.flac \
"https://gateway-lon.watsonplatform.net/speech-to-text/api/v1/recognize"

the error occures. It should probably return something like {"code":401, "error": "Unauthorized"}.