Last active
April 10, 2017 16:10
-
-
Save tylernappy/14d5215823c17f3a6dc52ba1677b9f75 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install the official Haven OnDemand Python wrapper: https://github.com/HPE-Haven-OnDemand/havenondemand-python | |
# pip install havenondemand | |
from havenondemand.hodclient import * | |
client = HODClient("APIKEY", "v1") | |
# params = {'file': 'path/to/file.mp3'} # if using a local file | |
params = {'url': 'https://www.havenondemand.com/sample-content/videos/hpnext.mp4'} # if using a publicly facing URL | |
response_async = client.post_request(params, HODApps.RECOGNIZE_SPEECH, async=True) | |
jobID = response_async['jobID'] | |
def getJobAsyncJobStatus(jobID): | |
print 'Processing...' | |
response = client.get_job_status(jobID) | |
if response == None: # still transcribing... | |
getJobAsyncJobStatus(jobID) | |
else: # done trasncribing | |
transcription = response['document'][0]['content'] | |
print transcription | |
getJobAsyncJobStatus(jobID) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hello tylernappy, i tried to run your code and i got an error message as follows:
Processing...
Traceback (most recent call last):
File "C:\Users\zain\AppData\Local\Programs\Python\Python36-32\videoTranscriptTest1.py", line 21, in <module> getJobAsyncJobStatus(jobID)
File "C:\Users\zain\AppData\Local\Programs\Python\Python36-32\videoTranscriptTest1.py", line 18, in getJobAsyncJobStatus transcription = response['document'][0]['content']
KeyError: 'document'
i have no idea what is wrong here, could you help out on this matter? thanks in advance