{"action":"created","issue":{"url":"https://api.github.com/repos/watson-developer-cloud/python-sdk/issues/551","repository_url":"https://api.github.com/repos/watson-developer-cloud/python-sdk","labels_url":"https://api.github.com/repos/watson-developer-cloud/python-sdk/issues/551/labels{/name}","comments_url":"https://api.github.com/repos/watson-developer-cloud/python-sdk/issues/551/comments","events_url":"https://api.github.com/repos/watson-developer-cloud/python-sdk/issues/551/events","html_url":"https://github.com/watson-developer-cloud/python-sdk/issues/551","id":357503505,"node_id":"MDU6SXNzdWUzNTc1MDM1MDU=","number":551,"title":"how to reduce IBM Watson speech to text Response time to 1 second","user":{"login":"saravana8888","id":20209425,"node_id":"MDQ6VXNlcjIwMjA5NDI1","avatar_url":"https://avatars1.githubusercontent.com/u/20209425?v=4","gravatar_id":"","url":"https://api.github.com/users/saravana8888","html_url":"https://github.com/saravana8888","followers_url":"https://api.github.com/users/saravana8888/followers","following_url":"https://api.github.com/users/saravana8888/following{/other_user}","gists_url":"https://api.github.com/users/saravana8888/gists{/gist_id}","starred_url":"https://api.github.com/users/saravana8888/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saravana8888/subscriptions","organizations_url":"https://api.github.com/users/saravana8888/orgs","repos_url":"https://api.github.com/users/saravana8888/repos","events_url":"https://api.github.com/users/saravana8888/events{/privacy}","received_events_url":"https://api.github.com/users/saravana8888/received_events","type":"User","site_admin":false},"labels":[{"id":262304348,"node_id":"MDU6TGFiZWwyNjIzMDQzNDg=","url":"https://api.github.com/repos/watson-developer-cloud/python-sdk/labels/support","name":"support","color":"0e8a16","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-09-06T05:41:31Z","updated_at":"2018-09-13T05:14:19Z","closed_at":"2018-09-12T21:25:32Z","author_association":"NONE","body":"#### Expected behavior\r\nWe need to get text response less than 1 second.\r\n#### Actual behavior\r\nIt is taking around 8 seconds to get text response.\r\n#### Steps to reproduce the problem\r\n\r\nWe have executed the Speech to Text code available in the below link in Linux Ubuntu 16.04 - 64 Bit\r\n\r\nhttps://github.com/watson-developer-cloud/python-sdk/blob/master/examples/microphone-speech-to-text.py\r\n\r\n#### Code snippet (Note: Do not paste your credentials)\r\n\r\n___________________________________________________________________________\r\n\r\nfrom __future__ import print_function\r\nimport pyaudio\r\nimport tempfile\r\nfrom watson_developer_cloud import SpeechToTextV1\r\nfrom watson_developer_cloud.websocket import RecognizeCallback\r\nimport os.path\r\nimport datetime\r\nimport time\r\n\r\nt1 = 0\r\n# USERNAME = NEED TO UPDATE\r\n# PASSWORD = NEED TO UPDATE\r\nspeech_to_text = SpeechToTextV1(\r\n    username='USERNAME',\r\n    password='PASSWORD',\r\n    url='https://stream.watsonplatform.net/speech-to-text/api')\r\n\r\n\r\n# Example using websockets\r\nclass MyRecognizeCallback(RecognizeCallback):\r\n    def __init__(self):\r\n        RecognizeCallback.__init__(self)\r\n\r\n    def on_transcription(self, transcript):\r\n        print(transcript)\r\n\tprint (\"Request receive Time:\" + str(time.time()))\r\n\tt2 = datetime.datetime.now()\r\n\tprint (t2-t1)\r\n\r\n    def on_connected(self):\r\n        print('Connection was successful')\r\n\r\n    def on_error(self, error):\r\n        print('Error received: {}'.format(error))\r\n\r\n    def on_inactivity_timeout(self, error):\r\n        print('Inactivity timeout: {}'.format(error))\r\n\r\n    def on_listening(self):\r\n        print('Service is listening')\r\n\r\n    def on_transcription_complete(self):\r\n        print('Transcription completed')\r\n        print (\"Request receive Time:\" + str(time.time()))\r\n\tt3 = datetime.datetime.now() \r\n\tprint (t3-t1)\r\n\r\n    def on_hypothesis(self, hypothesis):\r\n        print(hypothesis)\r\n\r\n\r\nmycallback = MyRecognizeCallback()\r\ntmp = tempfile.NamedTemporaryFile()\r\n\r\nFORMAT = pyaudio.paInt16\r\n#FORMAT = pyaudio.paCustomFormat\r\nCHANNELS = 1\r\nRATE = 44100\r\nCHUNK = 1024\r\nRECORD_SECONDS = 5\r\n\r\naudio = pyaudio.PyAudio()\r\nstream = audio.open(format=FORMAT,channels=CHANNELS,rate=RATE,input=True,frames_per_buffer=CHUNK)\r\n\r\nprint('recording....')\r\nwith open(tmp.name, 'w') as f:\r\n    for i in range(0, int(RATE / CHUNK * RECORD_SECONDS)):\r\n        data = stream.read(CHUNK)\r\n        f.write(data)\r\n\r\nstream.stop_stream()\r\nstream.close()\r\naudio.terminate()\r\nprint('Done recording...')\r\nprint (\"Request Sent Time:\" + str(time.time()))\r\nt1 = datetime.datetime.now()\r\nwith open(tmp.name) as f:\r\n    speech_to_text.recognize_with_websocket(audio=f,recognize_callback=mycallback)\r\n_____________________________________________________________________________________\r\n\r\n\r\n\r\n\r\n#### python version\r\n\r\n2.7.1\r\n\r\n#### Request Support\r\n\r\nPlease execute the same in your environment and share the updated code to get less than 1 second text response.\r\n"},"comment":{"url":"https://api.github.com/repos/watson-developer-cloud/python-sdk/issues/comments/420885859","html_url":"https://github.com/watson-developer-cloud/python-sdk/issues/551#issuecomment-420885859","issue_url":"https://api.github.com/repos/watson-developer-cloud/python-sdk/issues/551","id":420885859,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMDg4NTg1OQ==","user":{"login":"saravana8888","id":20209425,"node_id":"MDQ6VXNlcjIwMjA5NDI1","avatar_url":"https://avatars1.githubusercontent.com/u/20209425?v=4","gravatar_id":"","url":"https://api.github.com/users/saravana8888","html_url":"https://github.com/saravana8888","followers_url":"https://api.github.com/users/saravana8888/followers","following_url":"https://api.github.com/users/saravana8888/following{/other_user}","gists_url":"https://api.github.com/users/saravana8888/gists{/gist_id}","starred_url":"https://api.github.com/users/saravana8888/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saravana8888/subscriptions","organizations_url":"https://api.github.com/users/saravana8888/orgs","repos_url":"https://api.github.com/users/saravana8888/repos","events_url":"https://api.github.com/users/saravana8888/events{/privacy}","received_events_url":"https://api.github.com/users/saravana8888/received_events","type":"User","site_admin":false},"created_at":"2018-09-13T05:14:19Z","updated_at":"2018-09-13T05:14:19Z","author_association":"NONE","body":"can you provide link of 2.0.0 release code?\r\n\r\nhttps://github.com/watson-developer-cloud/python-sdk/blob/master/examples/speech_to_text_v1.py\r\n\r\ncan not import Audiosource error coming \r\nhelp to resolve above error\r\n"}}
{"actor":{"display_login":"saravana8888"}}