Closed maxcogay closed 6 years ago
hey @maxcogay -- This may be related to the audio being sent. Can inspect it, to make sure there is actual text being said in the audio? If yes, please email me the wav file and I can try to repro (stopachka [at] fb [dat] com)
hey @stopachka , I have checked the audio file very well in advance, I can use the current is not
Hey @maxcogay -- I am not sure what you mean by that sentence x} -- do you mind rephrasing?
hi @stopachka hello i sent the audio file through your mail :stepan.p@gmail.com , you can check it for me ,I'm a new member of github so I do not understand much about how to use your compassion
I´m having the same issue,yesterday was working just fine,but now I´m getting the "KeyError: '_text"
Here´s my code:
######################################################################## import requests import json from Gravador_E import record_audio, read_audio
API_ENDPOINT = 'https://api.wit.ai/speech'
wit_access_token = 'OJZILMLT5N25GUKTLGTKCHTPTNQLFIVZ'
def RecognizeSpeech(AUDIO_FILENAME, num_seconds = 10):
# record audio of specified length in specified audio file
record_audio(num_seconds, AUDIO_FILENAME)
# reading audio
audio = read_audio(AUDIO_FILENAME)
# defining headers for HTTP request
headers = {'authorization': 'Bearer ' + wit_access_token,
'Content-Type': 'audio/wav'}
# making an HTTP post request
resp = requests.post(API_ENDPOINT, headers = headers,
data = audio)
# converting response content to JSON format
data = json.loads(resp.content)
# get text from data
text = data['_text']
# return the text
return text
text = RecognizeSpeech('myspeech.wav', 4) print((text))
#############################################################################
Here´s the Recording Code:
import pyaudio import wave
def record_audio(RECORD_SECONDS, WAVE_OUTPUT_FILENAME):
FORMAT = pyaudio.paInt16 # format of wave
CHANNELS = 1#2 # no. of audio channels
RATE = 44100 # frame rate
CHUNK = 2000 # frames per audio sample
#--------------------------------------------------------#
# creating PyAudio object
audio = pyaudio.PyAudio()
# open a new stream for microphone
# It creates a PortAudio Stream Wrapper class object
stream = audio.open(format=FORMAT,channels=CHANNELS,
rate=RATE, input=True,
frames_per_buffer=CHUNK)
#----------------- start of recording -------------------#
# list to save all audio frames
frames = []
for i in range(int(RATE / CHUNK * RECORD_SECONDS)):
# read audio stream from microphone
data = stream.read(CHUNK)
# append audio data to frames list
frames.append(data)
#------------------ end of recording --------------------#
stream.stop_stream() # stop the stream object
stream.close() # close the stream object
audio.terminate() # terminate PortAudio
#------------------ saving audio ------------------------#
# create wave file object
waveFile = wave.open(WAVE_OUTPUT_FILENAME, 'wb')
# settings for wave file object
waveFile.setnchannels(CHANNELS)
waveFile.setsampwidth(audio.get_sample_size(FORMAT))
waveFile.setframerate(RATE)
waveFile.writeframes(b''.join(frames))
# closing the wave file object
waveFile.close()
def read_audio(WAVE_FILENAME):
with open(WAVE_FILENAME, 'rb') as f:
audio = f.read()
return audio
Hey team, apologies for the inconvenience, we ended up with an unexpected bug that lay quietly in our speech api, which affected your usage. We've went ahead patched the service, so things should be working once more, with a long-term fix on the way.
Yeah,that fixed it,Thank you guys
Do you want to request a feature, report a bug, or ask a question about wit? question What is the current behavior? I can not communicate with the bot anymore, but I can communicate the day before, but today it only returns bad requests Is my APP locked?
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.Have call API from 'https://api.wit.ai/speech?
What is the expected behavior?
please tell me the result What is the App ID where you are experiencing this issue (if applicable)? 5b16ab19-c610-47f8-881c-5a94ff08caf8