Skip to content

Commit

Permalink
feat: fix this issue
Browse files Browse the repository at this point in the history
  • Loading branch information
msadeqsirjani committed Jun 13, 2023
1 parent a8a50d3 commit 79c551f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ def ask(language: str):
prompt = speech_to_text.convert(file_path=secure_file_path,
language=language)

if prompt is None:
return jsonify({"data": None,
"message": "Google Speech Recognition could not understand audio",
"status": "success"}), 400

os.remove(secure_file_path)

engine = gpt_engine.GptEngine()
Expand Down
2 changes: 1 addition & 1 deletion voice_engine/speech_to_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import speech_recognition as sr


def convert(file_path: str, language: str = 'en-US') -> str:
def convert(file_path: str, language: str = 'en') -> str:
recognizer = sr.Recognizer()

with sr.AudioFile(file_path) as src:
Expand Down

0 comments on commit 79c551f

Please sign in to comment.