HassanDataSci commited on
Commit
c1821da
·
verified ·
1 Parent(s): f83534a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -23,7 +23,6 @@ def load_bloom_pipeline():
23
 
24
  pipe_bloom = load_bloom_pipeline()
25
 
26
- # Function to generate ingredients using BLOOM
27
  def get_ingredients_bloom(food_name):
28
  """
29
  Generate a list of ingredients for the given food item using BLOOM.
@@ -35,7 +34,8 @@ def get_ingredients_bloom(food_name):
35
  "For example, if the food is pizza, respond with 'cheese, tomato sauce, bread, olive oil, basil'."
36
  )
37
  try:
38
- response = pipe_bloom(prompt, max_length=50, num_return_sequences=1)
 
39
  generated_text = response[0]["generated_text"].strip()
40
 
41
  # Post-process the response
@@ -48,8 +48,8 @@ def get_ingredients_bloom(food_name):
48
 
49
  return ingredients
50
  except Exception as e:
 
51
  return f"Error generating ingredients: {e}"
52
-
53
  # Streamlit app setup
54
  st.title("Food Image Recognition with Ingredients")
55
 
 
23
 
24
  pipe_bloom = load_bloom_pipeline()
25
 
 
26
  def get_ingredients_bloom(food_name):
27
  """
28
  Generate a list of ingredients for the given food item using BLOOM.
 
34
  "For example, if the food is pizza, respond with 'cheese, tomato sauce, bread, olive oil, basil'."
35
  )
36
  try:
37
+ # Generate response from the model
38
+ response = pipe_bloom(prompt, max_new_tokens=50, num_return_sequences=1)
39
  generated_text = response[0]["generated_text"].strip()
40
 
41
  # Post-process the response
 
48
 
49
  return ingredients
50
  except Exception as e:
51
+ # Handle any errors that occur during the process
52
  return f"Error generating ingredients: {e}"
 
53
  # Streamlit app setup
54
  st.title("Food Image Recognition with Ingredients")
55