Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 =
|
| 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
|
| 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 |
|