Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,8 +3,8 @@ import azure.cognitiveservices.speech as speechsdk
|
|
| 3 |
|
| 4 |
def assess_pronunciation(audio_file, reference_text):
|
| 5 |
# Configure Azure Speech Service
|
| 6 |
-
speech_key = "
|
| 7 |
-
service_region = "
|
| 8 |
speech_config = speechsdk.SpeechConfig(subscription=speech_key, region=service_region)
|
| 9 |
|
| 10 |
# Set up the audio configuration
|
|
@@ -49,10 +49,7 @@ def assess_pronunciation(audio_file, reference_text):
|
|
| 49 |
elif result.reason == speechsdk.ResultReason.Canceled:
|
| 50 |
cancellation_details = speechsdk.CancellationDetails(result)
|
| 51 |
print(f"CANCELED: Reason={cancellation_details.reason}")
|
| 52 |
-
|
| 53 |
-
print(f"CANCELED: ErrorCode={cancellation_details.error_code}")
|
| 54 |
-
print(f"CANCELED: ErrorDetails={cancellation_details.error_details}")
|
| 55 |
-
print("CANCELED: Did you update the subscription info?")
|
| 56 |
return {"Error": f"Speech recognition canceled: {cancellation_details.error_details}"}
|
| 57 |
|
| 58 |
# Create Gradio interface
|
|
|
|
| 3 |
|
| 4 |
def assess_pronunciation(audio_file, reference_text):
|
| 5 |
# Configure Azure Speech Service
|
| 6 |
+
speech_key = "12afe22c558a4f8d8bd28d6a67cdb9b0"
|
| 7 |
+
service_region = "westus"
|
| 8 |
speech_config = speechsdk.SpeechConfig(subscription=speech_key, region=service_region)
|
| 9 |
|
| 10 |
# Set up the audio configuration
|
|
|
|
| 49 |
elif result.reason == speechsdk.ResultReason.Canceled:
|
| 50 |
cancellation_details = speechsdk.CancellationDetails(result)
|
| 51 |
print(f"CANCELED: Reason={cancellation_details.reason}")
|
| 52 |
+
print(f"CANCELED: ErrorDetails={cancellation_details.error_details}")
|
|
|
|
|
|
|
|
|
|
| 53 |
return {"Error": f"Speech recognition canceled: {cancellation_details.error_details}"}
|
| 54 |
|
| 55 |
# Create Gradio interface
|