@@ -4,7 +4,7 @@ author: mrbullwinkle
4
4
ms.author : mbullwin
5
5
ms.service : openai
6
6
ms.topic : include
7
- ms.date : 1/25 /2024
7
+ ms.date : 3/19 /2024
8
8
---
9
9
10
10
## Python
@@ -18,16 +18,16 @@ ms.date: 1/25/2024
18
18
19
19
Install the OpenAI Python client library with:
20
20
21
- # [ OpenAI Python 0.28.1 ] ( #tab/python )
21
+ # [ OpenAI Python 1.x ] ( #tab/python-new )
22
22
23
23
``` console
24
- pip install openai==0.28.1
24
+ pip install openai
25
25
```
26
26
27
- # [ OpenAI Python 1.x ] ( #tab/python-new )
27
+ # [ OpenAI Python 0.28.1 ] ( #tab/python )
28
28
29
29
``` console
30
- pip install openai
30
+ pip install openai==0.28.1
31
31
```
32
32
33
33
---
@@ -36,30 +36,30 @@ pip install openai
36
36
37
37
1 . Replace the contents of quickstart.py with the following code. Modify the code to add your deployment name:
38
38
39
- ``` python
40
- import openai
41
- import time
42
- import os
43
-
44
- openai.api_key = os.getenv(" AZURE_OPENAI_API_KEY" )
45
- openai.api_base = os.getenv(" AZURE_OPENAI_ENDPOINT" ) # your endpoint should look like the following https://YOUR_RESOURCE_NAME.openai.azure.com/
46
- openai.api_type = " azure"
47
- openai.api_version = " 2024-02-01"
48
-
49
- model_name = " whisper"
50
- deployment_id = " YOUR-DEPLOYMENT-NAME-HERE" # This will correspond to the custom name you chose for your deployment when you deployed a model."
51
- audio_language= " en"
52
-
53
- audio_test_file = " ./wikipediaOcelot.wav"
54
-
55
- result = openai.Audio.transcribe(
56
- file = open (audio_test_file, " rb" ),
57
- model = model_name,
58
- deployment_id = deployment_id
59
- )
60
-
61
- print (result)
62
- ```
39
+ ``` python
40
+ import openai
41
+ import time
42
+ import os
43
+
44
+ openai.api_key = os.getenv(" AZURE_OPENAI_API_KEY" )
45
+ openai.api_base = os.getenv(" AZURE_OPENAI_ENDPOINT" ) # your endpoint should look like the following https://YOUR_RESOURCE_NAME.openai.azure.com/
46
+ openai.api_type = " azure"
47
+ openai.api_version = " 2024-02-01"
48
+
49
+ model_name = " whisper"
50
+ deployment_id = " YOUR-DEPLOYMENT-NAME-HERE" # This will correspond to the custom name you chose for your deployment when you deployed a model."
51
+ audio_language= " en"
52
+
53
+ audio_test_file = " ./wikipediaOcelot.wav"
54
+
55
+ result = openai.Audio.transcribe(
56
+ file = open (audio_test_file, " rb" ),
57
+ model = model_name,
58
+ deployment_id = deployment_id
59
+ )
60
+
61
+ print (result)
62
+ ```
63
63
64
64
Run the application with the python command on your quickstart file :
65
65
0 commit comments