From f12014833cae60fa56dde22b1257a0179bb28e34 Mon Sep 17 00:00:00 2001 From: Patrick_Pluto Date: Thu, 26 Sep 2024 09:52:31 +0200 Subject: [PATCH] backend audio fix woo --- py/voice.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/py/voice.py b/py/voice.py index ddf2a6d..ec6c407 100644 --- a/py/voice.py +++ b/py/voice.py @@ -4,17 +4,18 @@ import speech_recognition as sr class VoiceRecognition: @staticmethod def basic_recognition(audio, option): + print(type(audio)) print("preparing") r = sr.Recognizer() if option == "online": - print("online") - with audio as source: + with sr.AudioFile(audio) as source: + print("online") text = r.recognize_google_cloud(source) print("recognized as: " + text) return text elif option == "offline": - print("offline") - with audio as source: + with sr.AudioFile(audio) as source: + print("offline") text = r.recognize_sphinx(source) print("recognized as: " + text) return text