willn9 commited on
Commit
8249306
·
verified ·
1 Parent(s): 40ff22e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -27,7 +27,7 @@ Be concise and limit your response to 512 tokens or less."""
27
 
28
  try:
29
  # Call the OpenAI API
30
- response = openai.ChatCompletion.create(
31
  model="gpt-4", # Replace with "gpt-3.5-turbo" if needed
32
  messages=[
33
  {"role": "system", "content": "You are a helpful and knowledgeable digital marketing strategist."},
@@ -37,7 +37,7 @@ Be concise and limit your response to 512 tokens or less."""
37
  temperature=0.7,
38
  )
39
  # Extract the response text
40
- keyword_advice = response["choices"][0]["message"]["content"].strip()
41
  except Exception as e:
42
  keyword_advice = f"An error occurred: {str(e)}"
43
 
 
27
 
28
  try:
29
  # Call the OpenAI API
30
+ response = client.chat.completions.create(
31
  model="gpt-4", # Replace with "gpt-3.5-turbo" if needed
32
  messages=[
33
  {"role": "system", "content": "You are a helpful and knowledgeable digital marketing strategist."},
 
37
  temperature=0.7,
38
  )
39
  # Extract the response text
40
+ keyword_advice = response.choices[0].message.content.strip()
41
  except Exception as e:
42
  keyword_advice = f"An error occurred: {str(e)}"
43