dindizz commited on
Commit
ee157c6
·
verified ·
1 Parent(s): 2c7c107

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -12,7 +12,7 @@ def get_nutritional_info(description):
12
  prompt = f"{nutrition_prompt}: {description}"
13
 
14
  try:
15
- response = openai.ChatCompletion.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,7 +21,7 @@ def get_nutritional_info(description):
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
 
 
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