-
Notifications
You must be signed in to change notification settings - Fork 267
/
08_openai.py
32 lines (24 loc) · 910 Bytes
/
08_openai.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from dotenv import load_dotenv
load_dotenv()
import openai
import webbrowser
# list all models
models = openai.Model.list()
print(models.data[0].root)
print(mod.root for mod in models.data)
# # create our completion
# completion = openai.Completion.create(model="ada", prompt="Bill Gates is a")
# print(completion.choices[0].text)
# image_gen = openai.Image.create(prompt="Zwei Hunde spielen unter einem Baum, cartoon",
# n=2,
# size="512x512"
# )
# # imgurl1 = image_gen.data[0].url
# # imgurl2 = image_gen.data[1].url
# # webbrowser.open(imgurl)
# for img in image_gen.data:
# webbrowser.open_new_tab(img.url)
# # Gwendolyn Brooks Writers' Conference - Keynote Address: Dr. Donda West
# audio = open("audio/donda.mp3", "rb")
# transcript = openai.Audio.transcribe("whisper-1", audio)
# print(transcript)