Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,15 +23,14 @@ def load_llama_pipeline():
|
|
| 23 |
|
| 24 |
pipe_llama = load_llama_pipeline()
|
| 25 |
|
| 26 |
-
# Function to generate ingredients using GPT-Neo
|
| 27 |
def get_ingredients_llama(food_name):
|
| 28 |
"""
|
| 29 |
Generate a list of ingredients for the given food item using GPT-Neo.
|
| 30 |
Returns a clean, comma-separated list of ingredients.
|
| 31 |
"""
|
| 32 |
prompt = (
|
| 33 |
-
f"List the main ingredients typically used to prepare {food_name}. "
|
| 34 |
-
"
|
| 35 |
)
|
| 36 |
try:
|
| 37 |
response = pipe_llama(prompt, max_length=50, num_return_sequences=1)
|
|
@@ -43,7 +42,6 @@ def get_ingredients_llama(food_name):
|
|
| 43 |
return ingredients
|
| 44 |
except Exception as e:
|
| 45 |
return f"Error generating ingredients: {e}"
|
| 46 |
-
|
| 47 |
# Streamlit app setup
|
| 48 |
st.title("Food Image Recognition with Ingredients")
|
| 49 |
|
|
|
|
| 23 |
|
| 24 |
pipe_llama = load_llama_pipeline()
|
| 25 |
|
|
|
|
| 26 |
def get_ingredients_llama(food_name):
|
| 27 |
"""
|
| 28 |
Generate a list of ingredients for the given food item using GPT-Neo.
|
| 29 |
Returns a clean, comma-separated list of ingredients.
|
| 30 |
"""
|
| 31 |
prompt = (
|
| 32 |
+
f"List only the main ingredients typically used to prepare {food_name}. "
|
| 33 |
+
"Respond with just the ingredients in a comma-separated list without any extra text or explanations."
|
| 34 |
)
|
| 35 |
try:
|
| 36 |
response = pipe_llama(prompt, max_length=50, num_return_sequences=1)
|
|
|
|
| 42 |
return ingredients
|
| 43 |
except Exception as e:
|
| 44 |
return f"Error generating ingredients: {e}"
|
|
|
|
| 45 |
# Streamlit app setup
|
| 46 |
st.title("Food Image Recognition with Ingredients")
|
| 47 |
|