Spaces:
Sleeping
Sleeping
Fixed the versions
Browse files21 unmodified lines2223242526272824 unmodified lines535455565758595 unmodified lines6566676869707121 unmodified lines# OPENAI_API_BASE was also hardcoded here , you should replace with your endpoint.os.environ["OPENAI_API_BASE"] = openai.api_base = "https://openaihelia.openai.azure.com/" #"https://japan-sean-aoai.openai.azure.com/"os.environ["OPENAI_API_VERSION"] = openai.api_version = "2023-04-01" #"2024-04-01-preview"openai.api_key = os.environ["OPENAI_API_KEY"]24 unmodified lines}# Making the initial POST requestresponse = requests.post(f"{base_url}?api-version=2022-10-01-preview", headers=headers, json=data)# Get the operation-location from the response headeroperation_location = response.headers.get('operation-location')5 unmodified lines# Make a subsequent GET request to retrieve the results using the JOB-IDsuccess = Falsewhile not success:result_response = requests.get(f"{base_url}/{job_id}?api-version=2022-10-01-preview", headers=headers)if result_response.json()['status'] == 'succeeded':success = Trueelse:21 unmodified lines2223242526272824 unmodified lines535455565758595 unmodified lines6566676869707121 unmodified lines# OPENAI_API_BASE was also hardcoded here , you should replace with your endpoint.os.environ["OPENAI_API_BASE"] = openai.api_base = "https://openaihelia.openai.azure.com/" #"https://japan-sean-aoai.openai.azure.com/"os.environ["OPENAI_API_VERSION"] = openai.api_version = "2024-04-01-preview" #"2023-04-01"openai.api_key = os.environ["OPENAI_API_KEY"]24 unmodified lines}# Making the initial POST requestresponse = requests.post(f"{base_url}?api-version=2023-04-01", headers=headers, json=data) #2022-10-01-preview# Get the operation-location from the response headeroperation_location = response.headers.get('operation-location')5 unmodified lines# Make a subsequent GET request to retrieve the results using the JOB-IDsuccess = Falsewhile not success:result_response = requests.get(f"{base_url}/{job_id}?api-version=2023-04-01", headers=headers) #2022-10-01-previewif result_response.json()['status'] == 'succeeded':success = Trueelse:
app.py+3-3