Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import openai
|
2 |
import gradio as gr
|
3 |
|
4 |
-
openai.api_key = "sk-R3HlMsYBk0NpAlLu2aA4B19054Ea4884A2Cf93D25662243d"
|
5 |
openai.api_base="https://apai.zyai.online/v1"
|
6 |
|
7 |
def predict(message, history):
|
@@ -11,11 +11,20 @@ def predict(message, history):
|
|
11 |
history_openai_format.append({"role": "assistant", "content":assistant})
|
12 |
history_openai_format.append({"role": "user", "content": message})
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
response = openai.ChatCompletion.create(
|
15 |
-
model=
|
16 |
-
messages=
|
17 |
-
temperature=1
|
18 |
-
|
|
|
|
|
|
|
19 |
)
|
20 |
|
21 |
partial_message = ""
|
|
|
1 |
import openai
|
2 |
import gradio as gr
|
3 |
|
4 |
+
openai.api_key = "sk-R3HlMsYBk0NpAlLu2aA4B19054Ea4884A2Cf93D25662243d"
|
5 |
openai.api_base="https://apai.zyai.online/v1"
|
6 |
|
7 |
def predict(message, history):
|
|
|
11 |
history_openai_format.append({"role": "assistant", "content":assistant})
|
12 |
history_openai_format.append({"role": "user", "content": message})
|
13 |
|
14 |
+
# response = openai.ChatCompletion.create(
|
15 |
+
# model='gpt-3.5-turbo',
|
16 |
+
# messages= history_openai_format,
|
17 |
+
# temperature=1.0,
|
18 |
+
# stream=True
|
19 |
+
# )
|
20 |
response = openai.ChatCompletion.create(
|
21 |
+
model="gpt-3.5-turbo", # 对话模型的名称
|
22 |
+
messages=history_openai_format,
|
23 |
+
temperature=1, # 值在[0,1]之间,越大表示回复越具有不确定性
|
24 |
+
max_tokens=600, # 回复最大的字符数
|
25 |
+
top_p=1,
|
26 |
+
frequency_penalty=0, # [-2,2]之间,该值越大则更倾向于产生不同的内容
|
27 |
+
presence_penalty=0, # [-2,2]之间,该值越大则更倾向于产生不同的内容
|
28 |
)
|
29 |
|
30 |
partial_message = ""
|