Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
#
|
|
|
|
| 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 |
-
|
|
|
|
|
|
|
| 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(
|