Код: Выделить всё
Connection failed (no connection to the remote host). Internal error: 1. Error details: Failed with error: WS_OPEN_ERROR_UNDERLYING_IO_OPEN_FAILED wss://eastus.tts.speech.microsoft.com/cognitiveservices/websocket/v1 X-ConnectionId: 45e9f87a28fa40ba981221cb55f6fc15 USP state: Sending. Received audio size: 0 bytes.
Код: Выделить всё
try:
file_url = None
speech_config = speechsdk.SpeechConfig(
subscription=my_azure_ai_speech_api_key,
region="eastus"
)
local_audio_path = f"/tmp/{filename}"
ensure_directory_exists(local_audio_path)
audio_config = speechsdk.audio.AudioOutputConfig(filename=local_audio_path)
synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config, audio_config=audio_config)
result = synthesizer.speak_text_async(text).get()
if result.reason == speechsdk.ResultReason.Canceled:
cancellation_details = result.cancellation_details
cancellation_reason = cancellation_details.reason
cancellation_error = ""
if cancellation_details.reason == speechsdk.CancellationReason.Error:
cancellation_error = cancellation_details.error_details
# Logic to log error here, this is actually where the error occurs that I mentioned above
return
with open(local_audio_path, "rb") as audio_file:
audio_data = audio_file.read()
# Logic to write the audio file to my Azure Blob Storage here
# Logic to remove the local file here
return file_url
except Exception as e:
# Logic to log error here
Код: Выделить всё
#!/bin/bash
# Log start of script
echo "Starting startup script"
# Update package lists
echo "Updating package lists"
apt-get update
# Install dependencies
echo "Installing dependencies"
apt-get install -y build-essential libssl-dev ca-certificates libasound2 wget
# Install OpenSSL 1.1
echo "Installing OpenSSL 1.1"
wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.19_amd64.deb
dpkg -i libssl1.1_1.1.1f-1ubuntu2.19_amd64.deb
# Verify installations
echo "Verifying OpenSSL installation"
openssl version
# Log end of script
echo "Startup script completed"
Код: Выделить всё
WEBSITE_STARTUP_SCRIPT=startup.sh
WEBSITE_RUN_FROM_PACKAGE=1
- Проверил свой ключ и регион Azure AI Speech API, они верны (также зарегистрировал их в самом приложении-функции)< /li>
Добавил свое приложение-функцию в службу речи Azure AI в системе контроля доступа (AIM) в качестве разработчика Azure AI. - Попытался повторно развернуть и перезапустить свое приложение-функцию. несколько раз
Подробнее здесь: https://stackoverflow.com/questions/787 ... lying-io-o
Мобильная версия