Функция Azure с проблемой сети речи Azure AI (WS_OPEN_ERROR_UNDERLYING_IO_OPEN_FAILED)Linux

Ответить
Anonymous
 Функция Azure с проблемой сети речи Azure AI (WS_OPEN_ERROR_UNDERLYING_IO_OPEN_FAILED)

Сообщение Anonymous »

Я использую Azure AI Speech (ранее — Azure Cognitive Services), в частности функцию преобразования текста в речь (TTS) в приложении Python Azure Function (Linux). Однако когда мое приложение-функция работает и пытается вызвать службу речи AI, оно выдает следующую ошибку:

Код: Выделить всё

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
Я занимаюсь разработкой на компьютере под управлением Windows, и локально приложение Azure Function работает нормально и успешно вызывает службу AI Speech. Эта проблема возникает только в облаке Azure с развернутым приложением-функцией Azure. Я уже пытался искать решения, и мне предлагалось установить OpenSSL 1.1 в среду моего приложения-функции, поэтому я создал этот сценарий запуска (startup.sh):

Код: Выделить всё

#!/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
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Linux»