All the the requests to the Audio Language Detection API return either "Error 500: Internal Server Error", or the detected language as "Unknown". The same output is returned when testing the feature within the Sunbird platform playground. This was tested on audio formats including (mp3, WAV and Opus).
Below is the sample script to help reproduce the issue.
from dotenv import load_dotenv
import requests, os
load_dotenv("secrets.env")
LANG_DETECT_URL = "https://api.sunbird.ai/tasks/auto_detect_audio_language"
AUTHORIZATION_KEY = os.getenv("SUNBIRD_API_KEY")
def language_detection(filename):
headers = {
"Authorization": AUTHORIZATION_KEY
}
with open(filename, 'rb') as f:
files = {'audio': ('voice.wav', f, 'audio/wav')}
lang_detect_response = requests.post(LANG_DETECT_URL, files=files, headers=headers)
if lang_detect_response.status_code != 200:
print(f"Error {lang_detect_response.status_code}: {lang_detect_response.text}")
return None
lang_detect_json = lang_detect_response.json()
detected_lang = lang_detect_json['detected_language']
if not detected_lang:
print("Error: Language detection failed. The output of lang_detect_json is:", lang_detect_json)
return None
return detected_lang
if __name__ == "__main__":
filename = "test_audio.wav"
detected_language = language_detection(filename)
if detected_language:
print(f"Detected language: {detected_language}")
else:
print("Language detection failed.")
All the the requests to the Audio Language Detection API return either "Error 500: Internal Server Error", or the detected language as "Unknown". The same output is returned when testing the feature within the Sunbird platform playground. This was tested on audio formats including (mp3, WAV and Opus).
Below is the sample script to help reproduce the issue.