aikitty commited on
Commit
38b5697
·
verified ·
1 Parent(s): 61c94e1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -25,7 +25,8 @@ def assess_pronunciation(audio_file):
25
  # Recognize speech and assess pronunciation
26
  result = recognizer.recognize_once()
27
 
28
- # Check if the result is valid
 
29
  if result.reason == speechsdk.ResultReason.RecognizedSpeech:
30
  pronunciation_result = speechsdk.PronunciationAssessmentResult(result)
31
 
@@ -42,7 +43,9 @@ def assess_pronunciation(audio_file):
42
  "Prosody": prosody_score
43
  }
44
  else:
45
- return {"Error": "Speech could not be recognized. Please try again with a clearer audio."}
 
 
46
 
47
  # Create Gradio interface
48
  interface = gr.Interface(
 
25
  # Recognize speech and assess pronunciation
26
  result = recognizer.recognize_once()
27
 
28
+ # Debug information
29
+ print(f"Recognition result reason: {result.reason}")
30
  if result.reason == speechsdk.ResultReason.RecognizedSpeech:
31
  pronunciation_result = speechsdk.PronunciationAssessmentResult(result)
32
 
 
43
  "Prosody": prosody_score
44
  }
45
  else:
46
+ print(f"Recognition result text: {result.text}")
47
+ print(f"Recognition error details: {result.error_details}")
48
+ return {"Error": "There was an error. Speech could not be recognized."}
49
 
50
  # Create Gradio interface
51
  interface = gr.Interface(