Update app.py
Browse files
app.py
CHANGED
|
@@ -12,7 +12,7 @@ def get_nutritional_info(description):
|
|
| 12 |
prompt = f"{nutrition_prompt}: {description}"
|
| 13 |
|
| 14 |
try:
|
| 15 |
-
response = openai.
|
| 16 |
model="gpt-4o-mini", # Assuming GPT-4o-mini is the text model you're using
|
| 17 |
messages=[
|
| 18 |
{"role": "system", "content": "You are a nutrition expert."},
|
|
@@ -21,7 +21,7 @@ def get_nutritional_info(description):
|
|
| 21 |
max_tokens=300,
|
| 22 |
temperature=0.7
|
| 23 |
)
|
| 24 |
-
return response.choices[0].message
|
| 25 |
except Exception as e:
|
| 26 |
return f"Oops! Something went wrong with nutritional breakdown: {str(e)}"
|
| 27 |
|
|
|
|
| 12 |
prompt = f"{nutrition_prompt}: {description}"
|
| 13 |
|
| 14 |
try:
|
| 15 |
+
response = openai.chat.completions.create(
|
| 16 |
model="gpt-4o-mini", # Assuming GPT-4o-mini is the text model you're using
|
| 17 |
messages=[
|
| 18 |
{"role": "system", "content": "You are a nutrition expert."},
|
|
|
|
| 21 |
max_tokens=300,
|
| 22 |
temperature=0.7
|
| 23 |
)
|
| 24 |
+
return response.choices[0].message.content.strip()
|
| 25 |
except Exception as e:
|
| 26 |
return f"Oops! Something went wrong with nutritional breakdown: {str(e)}"
|
| 27 |
|