Azure OpenAI Sprache zum Text -Whisper "Code": "404", "Nachricht": "Ressource nicht gefunden"

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Azure OpenAI Sprache zum Text -Whisper "Code": "404", "Nachricht": "Ressource nicht gefunden"

by Anonymous » 25 Jul 2025, 16:28

Ich versuche, eine Audiodatei zu transkribieren, indem ich Whisper über Azure OpenAI -Schlüssel, Endpunkte, Bereitstellungen verwendete.

Code: Select all

Error 404: {"error":{"code":"404","message": "Resource not found"}}
< /code>
Versuchte die Transkription auf dem Azure-Spielplatz mit derselben Bereitstellung aus.import os
import requests

# Azure OpenAI credentials
os.environ['AZURE_OPENAI_KEY'] = 'KEY'
os.environ['AZURE_OPENAI_ENDPOINT'] = 'ENDPOINT'

# Azure OpenAI metadata variables
openai = {
'api_key': os.environ.get('AZURE_OPENAI_KEY'),
'api_base': os.environ.get('AZURE_OPENAI_ENDPOINT'),
'api_version': '2023-06-01-preview',
'name': 'deployment name'
}

# Header for authentication
headers = {
'api-key': openai['api_key']
}

# audio file
file_path = '/content/drive/MyDrive/speech2text/sampleaudiO.wav'

# URL for the API endpoint
url = f"{openai['api_base']}/openai/deployments/{openai['name']}/audio/transcriptions?api-version={openai['api_version']}"

try:
# Reading the audio file as binary data
with open(file_path, 'rb') as audio_file:
# Send the request to Azure OpenAI for transcription
response = requests.post(url, headers=headers, files={"file": audio_file})

# Check if the request was successful and print the transcription
if response.status_code == 200:
transcription = response.json().get('text', 'Transcription not available')
print("Transcription:", transcription)
else:
print(f"Error {response.status_code}: {response.text}")

except Exception as e:
print(f"An error occurred: {e}")
here

Top