ParthBhuptani commited on
Commit
c411eff
·
verified ·
1 Parent(s): 0082516

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -26,8 +26,12 @@ def generate_recipe(dietary_pref, ingredients):
26
  headers=headers,
27
  json=body
28
  )
29
- result = response.json()
30
- return result["result"]["alternatives"][0]["text"]
 
 
 
 
31
  except Exception as e:
32
  return f"❌ Error: {e}"
33
 
 
26
  headers=headers,
27
  json=body
28
  )
29
+ print("RAW RESPONSE:", response.text)
30
+ if response.status_code == 200:
31
+ result = response.json()
32
+ return result["result"]["alternatives"][0]["text"]
33
+ else:
34
+ return f"API Error {response.status_code}: {response.text}"
35
  except Exception as e:
36
  return f"❌ Error: {e}"
37