xiaofeifei commited on
Commit
e944dc7
1 Parent(s): 5e9d70a

Signed-off-by: vax521 <13263397018@163.com>

Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -4,14 +4,17 @@ import gradio as gr
4
  from pydantic import BaseModel
5
  import openai
6
 
 
 
7
 
8
  def ask_gpt(prompt):
9
- response = openai.Completion.create(
10
- engine="text-davinci-002",
11
- prompt=prompt,
12
- temperature=0.7,
13
- max_tokens=2000
14
  )
 
15
  return response.choices[0].text.strip()
16
 
17
 
 
4
  from pydantic import BaseModel
5
  import openai
6
 
7
+ openai.api_base = "https://api.wzunjh.top/v1"
8
+
9
 
10
  def ask_gpt(prompt):
11
+ response = openai.ChatCompletion.create(
12
+ model="gpt-3.5-turbo", # here we use `gpt-3.5-turbo` model, while Stanford-Alpaca uses `text-davinci-003`
13
+ messages=[
14
+ {"role": "user", "content": prompt},
15
+ ]
16
  )
17
+
18
  return response.choices[0].text.strip()
19
 
20