voice recognition trial 3

This commit is contained in:
YasinOnm08 2024-09-26 09:37:33 +02:00
parent 077b748849
commit 2517307ffc

View file

@ -1,14 +1,19 @@
import axios from "axios"; import axios from "axios";
class VoiceSend { class VoiceSend {
sendToVoiceRecognition(audio_data: Blob) { sendToVoiceRecognition(audio_data: Blob) {
console.log("sending recording..."); console.log("sending recording...");
console.log(typeof (audio_data));
console.log(audio_data instanceof Blob);
const dataSend = { audio:audio_data, option:"offline", recognition_type: "basic" }
const dataSend = { option:"offline", type: "basic",audio:audio_data }
axios.post("http://localhost:5000/interstellar_ai/api/voice_recognition", dataSend) axios.post("http://localhost:5000/interstellar_ai/api/voice_recognition", dataSend)
.then((response: any) => { .then((response) => {
console.log(response['response']) console.log(response.data)
return response['response'] return response.data.response
}) })
.catch(error => { .catch(error => {
console.log("Error calling API:", error) console.log("Error calling API:", error)