jadend commited on
Commit
eebd754
·
1 Parent(s): 57f68f6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -8,7 +8,12 @@ import huggingface_hub
8
  from huggingface_hub import Repository
9
  from datetime import datetime
10
 
11
- openai.api_key = os.environ.get("API_TOKEN")
 
 
 
 
 
12
  #client = OpenAI()
13
 
14
  # set up for the Hugging Face dataset, based on the directory you set up
@@ -45,7 +50,7 @@ user_db = {
45
 
46
  # the OpenAI function to use the given prompt to the model defined.
47
  def mr_bot(premise, tokens, temperature):
48
- response = openai.ChatCompletions.create(
49
  model="gpt-3.5-turbo",
50
  messages=[{"role": "user", "content": premise}],
51
  max_tokens=tokens,
 
8
  from huggingface_hub import Repository
9
  from datetime import datetime
10
 
11
+ client = OpenAI(
12
+ # This is the default and can be omitted
13
+ api_key=os.environ.get("OPENAI_API_KEY"),
14
+ )
15
+
16
+ #openai.api_key = os.environ.get("API_TOKEN")
17
  #client = OpenAI()
18
 
19
  # set up for the Hugging Face dataset, based on the directory you set up
 
50
 
51
  # the OpenAI function to use the given prompt to the model defined.
52
  def mr_bot(premise, tokens, temperature):
53
+ response = client.chat.completions.create(
54
  model="gpt-3.5-turbo",
55
  messages=[{"role": "user", "content": premise}],
56
  max_tokens=tokens,