Spaces:
Runtime error
Runtime error
Fix GenFood
Browse files
app.py
CHANGED
@@ -41,7 +41,7 @@ def generate_cook_image(query, app_id, app_key):
|
|
41 |
return None
|
42 |
|
43 |
data = rj["hits"]
|
44 |
-
data = data[random.randint(
|
45 |
|
46 |
if "recipe" not in data or "image" not in data["recipe"]:
|
47 |
return None
|
|
|
41 |
return None
|
42 |
|
43 |
data = rj["hits"]
|
44 |
+
data = data[random.randint(1, min(5, len(data) - 1))] if len(data) > 1 else data[0]
|
45 |
|
46 |
if "recipe" not in data or "image" not in data["recipe"]:
|
47 |
return None
|