Spaces:
Sleeping
Sleeping
Update app.py
Browse files22 unmodified lines232425262728295 unmodified lines353637383940416 unmodified lines484950515253545522 unmodified linespipe_bloom = load_bloom_pipeline()# Function to generate ingredients using BLOOMdef get_ingredients_bloom(food_name):"""Generate a list of ingredients for the given food item using BLOOM.5 unmodified lines"For example, if the food is pizza, respond with 'cheese, tomato sauce, bread, olive oil, basil'.")try:response = pipe_bloom(prompt, max_length=50, num_return_sequences=1)generated_text = response[0]["generated_text"].strip()# Post-process the response6 unmodified linesreturn ingredientsexcept Exception as e:return f"Error generating ingredients: {e}"# Streamlit app setupst.title("Food Image Recognition with Ingredients")22 unmodified lines2324252627285 unmodified lines34353637383940416 unmodified lines484950515253545522 unmodified linespipe_bloom = load_bloom_pipeline()def get_ingredients_bloom(food_name):"""Generate a list of ingredients for the given food item using BLOOM.5 unmodified lines"For example, if the food is pizza, respond with 'cheese, tomato sauce, bread, olive oil, basil'.")try:# Generate response from the modelresponse = pipe_bloom(prompt, max_new_tokens=50, num_return_sequences=1)generated_text = response[0]["generated_text"].strip()# Post-process the response6 unmodified linesreturn ingredientsexcept Exception as e:# Handle any errors that occur during the processreturn f"Error generating ingredients: {e}"# Streamlit app setupst.title("Food Image Recognition with Ingredients")
app.py+3-3