Spaces:
Runtime error
Runtime error
fix
Browse files
app.py
CHANGED
@@ -9,12 +9,9 @@ def callapi(p):
|
|
9 |
try:
|
10 |
response = openai.ChatCompletion.create(
|
11 |
model="gpt-3.5-turbo",
|
12 |
-
messages=
|
13 |
-
|
14 |
-
|
15 |
-
{"role":"user", "content":p}
|
16 |
-
]
|
17 |
-
)
|
18 |
)
|
19 |
display(response)
|
20 |
response = response["choices"][0]["message"]["content"]
|
@@ -29,7 +26,7 @@ def callapi(p):
|
|
29 |
|
30 |
|
31 |
def chat(p, qid, uid):
|
32 |
-
return callapi(p)
|
33 |
|
34 |
iface = gr.Interface(fn=chat,
|
35 |
inputs=["text", "text", "text"],
|
|
|
9 |
try:
|
10 |
response = openai.ChatCompletion.create(
|
11 |
model="gpt-3.5-turbo",
|
12 |
+
messages= [{"role":"system", "content":content},
|
13 |
+
{"role":"user", "content":p}
|
14 |
+
]
|
|
|
|
|
|
|
15 |
)
|
16 |
display(response)
|
17 |
response = response["choices"][0]["message"]["content"]
|
|
|
26 |
|
27 |
|
28 |
def chat(p, qid, uid):
|
29 |
+
return ["text", callapi(p)]
|
30 |
|
31 |
iface = gr.Interface(fn=chat,
|
32 |
inputs=["text", "text", "text"],
|