Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -26,8 +26,12 @@ def generate_recipe(dietary_pref, ingredients):
|
|
26 |
headers=headers,
|
27 |
json=body
|
28 |
)
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
|
|
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 |
|