Spaces:
Sleeping
Sleeping
Fixed the versions
Browse files
app.py
CHANGED
|
@@ -22,7 +22,7 @@ openai.api_type = "azure"
|
|
| 22 |
|
| 23 |
# OPENAI_API_BASE was also hardcoded here , you should replace with your endpoint.
|
| 24 |
os.environ["OPENAI_API_BASE"] = openai.api_base = "https://openaihelia.openai.azure.com/" #"https://japan-sean-aoai.openai.azure.com/"
|
| 25 |
-
os.environ["OPENAI_API_VERSION"] = openai.api_version = "
|
| 26 |
openai.api_key = os.environ["OPENAI_API_KEY"]
|
| 27 |
|
| 28 |
|
|
@@ -53,7 +53,7 @@ def analyze_healthcare_text(text):
|
|
| 53 |
}
|
| 54 |
|
| 55 |
# Making the initial POST request
|
| 56 |
-
response = requests.post(f"{base_url}?api-version=
|
| 57 |
|
| 58 |
# Get the operation-location from the response header
|
| 59 |
operation_location = response.headers.get('operation-location')
|
|
@@ -65,7 +65,7 @@ def analyze_healthcare_text(text):
|
|
| 65 |
# Make a subsequent GET request to retrieve the results using the JOB-ID
|
| 66 |
success = False
|
| 67 |
while not success:
|
| 68 |
-
result_response = requests.get(f"{base_url}/{job_id}?api-version=
|
| 69 |
if result_response.json()['status'] == 'succeeded':
|
| 70 |
success = True
|
| 71 |
else:
|
|
|
|
| 22 |
|
| 23 |
# OPENAI_API_BASE was also hardcoded here , you should replace with your endpoint.
|
| 24 |
os.environ["OPENAI_API_BASE"] = openai.api_base = "https://openaihelia.openai.azure.com/" #"https://japan-sean-aoai.openai.azure.com/"
|
| 25 |
+
os.environ["OPENAI_API_VERSION"] = openai.api_version = "2024-04-01-preview" #"2023-04-01"
|
| 26 |
openai.api_key = os.environ["OPENAI_API_KEY"]
|
| 27 |
|
| 28 |
|
|
|
|
| 53 |
}
|
| 54 |
|
| 55 |
# Making the initial POST request
|
| 56 |
+
response = requests.post(f"{base_url}?api-version=2023-04-01", headers=headers, json=data) #2022-10-01-preview
|
| 57 |
|
| 58 |
# Get the operation-location from the response header
|
| 59 |
operation_location = response.headers.get('operation-location')
|
|
|
|
| 65 |
# Make a subsequent GET request to retrieve the results using the JOB-ID
|
| 66 |
success = False
|
| 67 |
while not success:
|
| 68 |
+
result_response = requests.get(f"{base_url}/{job_id}?api-version=2023-04-01", headers=headers) #2022-10-01-preview
|
| 69 |
if result_response.json()['status'] == 'succeeded':
|
| 70 |
success = True
|
| 71 |
else:
|