Spaces:
Sleeping
Sleeping
HassanDataSci
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -23,9 +23,15 @@ def get_ingredients_google(food_name):
|
|
23 |
"""
|
24 |
Generate a list of ingredients for the given food item using Google Gemini AI.
|
25 |
"""
|
26 |
-
prompt = f"List the main ingredients typically used to prepare {food_name}
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
# Streamlit app setup
|
31 |
st.title("Food Image Recognition with Ingredients")
|
|
|
23 |
"""
|
24 |
Generate a list of ingredients for the given food item using Google Gemini AI.
|
25 |
"""
|
26 |
+
prompt = f"List the main ingredients typically used to prepare {food_name}."
|
27 |
+
try:
|
28 |
+
response = palm.generate_text(prompt=prompt)
|
29 |
+
if response and "candidates" in response:
|
30 |
+
return response["candidates"][0]["output"]
|
31 |
+
else:
|
32 |
+
return "No ingredients found."
|
33 |
+
except Exception as e:
|
34 |
+
return f"Error generating ingredients: {e}"
|
35 |
|
36 |
# Streamlit app setup
|
37 |
st.title("Food Image Recognition with Ingredients")
|