voice recognition trial 4
This commit is contained in:
parent
0c02d76d6f
commit
ea3fd09ea2
2 changed files with 14 additions and 9 deletions
|
@ -7,10 +7,13 @@ class VoiceSend {
|
||||||
console.log(typeof (audio_data));
|
console.log(typeof (audio_data));
|
||||||
console.log(audio_data instanceof Blob);
|
console.log(audio_data instanceof Blob);
|
||||||
|
|
||||||
|
const formdata = new FormData()
|
||||||
|
formdata.append("audio", audio_data)
|
||||||
|
formdata.append("option", "offline")
|
||||||
|
formdata.append("type", "basic")
|
||||||
|
|
||||||
|
const dataSend = { option:"offline", type:"basic",audio:audio_data }
|
||||||
const dataSend = { option:"offline", type: "basic",audio:audio_data }
|
axios.post("http://localhost:5000/interstellar_ai/api/voice_recognition", formdata)
|
||||||
axios.post("http://localhost:5000/interstellar_ai/api/voice_recognition", dataSend)
|
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log(response.data)
|
console.log(response.data)
|
||||||
return response.data.response
|
return response.data.response
|
||||||
|
|
10
py/api.py
10
py/api.py
|
@ -99,10 +99,12 @@ class API:
|
||||||
|
|
||||||
@self.app.route('/interstellar_ai/api/voice_recognition', methods=['POST'])
|
@self.app.route('/interstellar_ai/api/voice_recognition', methods=['POST'])
|
||||||
def voice_recognition():
|
def voice_recognition():
|
||||||
type = request.args.get('type')
|
print(request.args)
|
||||||
audio = request.args.get('audio')
|
recog_type = request.form.get('type')
|
||||||
option = request.args.get('option')
|
print(recog_type)
|
||||||
if type == "basic":
|
audio = request.files.get('audio')
|
||||||
|
option = request.form.get('option')
|
||||||
|
if recog_type == "basic":
|
||||||
text = self.voice.basic_recognition(audio, option)
|
text = self.voice.basic_recognition(audio, option)
|
||||||
return jsonify({'status': 200, 'response': text})
|
return jsonify({'status': 200, 'response': text})
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue