watson-developer-cloud / python-sdk

:snake: Client library to use the IBM Watson services in Python and available in pip as watson-developer-cloud
https://pypi.org/project/ibm-watson/
Apache License 2.0
1.45k stars 828 forks source link

Watson stt examples print out bunch of hex data #808

Closed daehyunryu closed 2 years ago

daehyunryu commented 3 years ago

Overview Watson stt examples print out bunch of hex data. I have plan to use it with Watson assistant and tts as well.

Expected behavior Expected to get only json output

How to reproduce Clone and ran microphone-speech-to-text.py and speech_to_text_v1.py example. microphone-speech-to-text.py prints out just bunch of hex code.

Screenshots image

SDK Version ibm-cloud-sdk-core 3.12.0 ibm-watson 5.3.0

Additional information:

Additional context I used en-US_Broadband_sample1.wav file from the link

daehyunryu commented 2 years ago

Websocket trace is enabled. websocket.enableTrace(True) should be commented in recognize_listener.py and synthesize_listener.py?

Kaustubh0699 commented 2 years ago

Were you able to solve this issue? I am also not able to get transcript for a streaming audio

daehyunryu commented 2 years ago

@Kaustubh0699 Not really. Do you see same hex data? As temporary workaroud, try again after commenting out websocket.enableTrace(True) in recognize_listener.py and synthesize_listener.py of watson lib.

Kaustubh0699 commented 2 years ago

Got a temporary workaround . Try this...... Insert the second line where above where you create the pyaudio stream object. This will disable all the loggings and output would be cleaner.

import logging logging.disable(logging.CRITICAL)

johann-petrak commented 2 years ago

Disabling my own logging is not really an option, why did this not get any attention yet? Having a released library dump out every single byte it sends over to you is really annoying.

mediumTaj commented 2 years ago

@apaparazzi0329 can you please take a look

apaparazzi0329 commented 2 years ago

@johann-petrak I am looking into this issue at the moment. Any suggestions and PRs are greatly appreciated. @daehyunryu your suggestion looks very promising I will look into that first.

johann-petrak commented 2 years ago

@apaparazzi0329 as I wrote in #813, this seems to happen because of https://github.com/watson-developer-cloud/python-sdk/blob/e8a2f1883822f0ad2d655d31a595dbd93f5c81c9/ibm_watson/websocket/recognize_listener.py#L56 It should be sufficient to just remove that line for the release code.

Note that this line is also present in SynthesizeListener, see https://github.com/watson-developer-cloud/python-sdk/blob/e8a2f1883822f0ad2d655d31a595dbd93f5c81c9/ibm_watson/websocket/synthesize_listener.py#L47 where it probably should also get removed.

johann-petrak commented 2 years ago

Here is the PR https://github.com/watson-developer-cloud/python-sdk/pull/814

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.