Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -33,14 +33,14 @@ def get_recipes(ingredients, max_calories=None, min_protein=None, max_fat=None,
|
|
33 |
"number": 5 # Return up to 5 recipes
|
34 |
}
|
35 |
|
36 |
-
# Add optional parameters only if they are provided
|
37 |
-
if max_calories
|
38 |
params["maxCalories"] = max_calories
|
39 |
-
if min_protein
|
40 |
params["minProtein"] = min_protein
|
41 |
-
if max_fat
|
42 |
params["maxFat"] = max_fat
|
43 |
-
if max_carbs
|
44 |
params["maxCarbs"] = max_carbs
|
45 |
|
46 |
# Debugging: Print request parameters
|
|
|
33 |
"number": 5 # Return up to 5 recipes
|
34 |
}
|
35 |
|
36 |
+
# Add optional parameters only if they are provided and not zero
|
37 |
+
if max_calories and max_calories > 0:
|
38 |
params["maxCalories"] = max_calories
|
39 |
+
if min_protein and min_protein > 0:
|
40 |
params["minProtein"] = min_protein
|
41 |
+
if max_fat and max_fat > 0:
|
42 |
params["maxFat"] = max_fat
|
43 |
+
if max_carbs and max_carbs > 0:
|
44 |
params["maxCarbs"] = max_carbs
|
45 |
|
46 |
# Debugging: Print request parameters
|