Spaces:
Sleeping
Sleeping
John Doe
commited on
Commit
·
e852070
1
Parent(s):
11526c9
small changes
Browse files
app.py
CHANGED
@@ -7,18 +7,24 @@ import gradio as gr
|
|
7 |
import koil
|
8 |
|
9 |
|
10 |
-
|
11 |
-
|
12 |
|
13 |
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
14 |
|
|
|
|
|
15 |
async def apredict(input):
|
16 |
timestamp = datetime.datetime.now().isoformat()
|
17 |
try:
|
18 |
-
api = openai(api_key = OPENAI_API_KEY)
|
19 |
except:
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
22 |
async with api, log:
|
23 |
response = await api(input)
|
24 |
addr = await log(
|
|
|
7 |
import koil
|
8 |
|
9 |
|
10 |
+
import lm.lm.openai
|
11 |
+
import lm.log.arweaveditems
|
12 |
|
13 |
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
14 |
|
15 |
+
MODEL = lm.lm.openai.DEFAULT_MODEL
|
16 |
+
|
17 |
async def apredict(input):
|
18 |
timestamp = datetime.datetime.now().isoformat()
|
19 |
try:
|
20 |
+
api = lm.lm.openai.openai(api_key = OPENAI_API_KEY, model = MODEL)
|
21 |
except:
|
22 |
+
if model == lm.lm.openai.DEFAULT_MODEL:
|
23 |
+
model = 'gpt-4'
|
24 |
+
api = lm.lm.openai.openai(api_key = OPENAI_API_KEY, model = MODEL)
|
25 |
+
else:
|
26 |
+
raise
|
27 |
+
log = lm.lm.arweaveditems.arweaveditems()
|
28 |
async with api, log:
|
29 |
response = await api(input)
|
30 |
addr = await log(
|