stchakman commited on
Commit
dd1a771
1 Parent(s): ae3548a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -71,25 +71,28 @@ def get_image_download_link(image, filename, text):
71
  href = f'<a download="{filename}" href="data:image/jpeg;base64,{img_str}" target="_blank">{text}</a>'
72
  return href
73
 
74
- st.title("Fridge to Dish App")
75
 
76
  uploaded_file = st.file_uploader("Upload an image of your ingredients", type=["jpg", "jpeg", "png"])
77
  if uploaded_file is not None:
78
  ingredients = extract_ingredients(uploaded_file)
79
  st.write("Ingredients found:")
80
  st.write(", ".join(ingredients))
 
 
81
 
82
  suggested_dishes = generate_dishes(ingredients)
83
 
84
  if len(suggested_dishes) > 0:
85
  st.write("Suggested dishes based on the ingredients:")
86
  for idx, dish in enumerate(suggested_dishes):
87
- st.write(f"{idx + 1}. {dish['name']}")
88
 
89
  for idx, dish in enumerate(suggested_dishes[:3]):
90
  if st.button(f"Generate Image for Dish {idx + 1}"):
91
- dish_image = generate_image(dish['name'])
92
- st.image(dish_image, caption=dish['name'], use_column_width=True)
93
  else:
94
  st.write("No dishes found for the given ingredients.")
 
95
 
 
71
  href = f'<a download="{filename}" href="data:image/jpeg;base64,{img_str}" target="_blank">{text}</a>'
72
  return href
73
 
74
+ st.title("Fridge 2 Dish App")
75
 
76
  uploaded_file = st.file_uploader("Upload an image of your ingredients", type=["jpg", "jpeg", "png"])
77
  if uploaded_file is not None:
78
  ingredients = extract_ingredients(uploaded_file)
79
  st.write("Ingredients found:")
80
  st.write(", ".join(ingredients))
81
+
82
+ st.image(uploaded_file, caption="Uploaded Image", use_column_width=True)
83
 
84
  suggested_dishes = generate_dishes(ingredients)
85
 
86
  if len(suggested_dishes) > 0:
87
  st.write("Suggested dishes based on the ingredients:")
88
  for idx, dish in enumerate(suggested_dishes):
89
+ st.write(f"{idx + 1}. {dish.split(':')[0]}")
90
 
91
  for idx, dish in enumerate(suggested_dishes[:3]):
92
  if st.button(f"Generate Image for Dish {idx + 1}"):
93
+ dish_image = generate_image(dish.split(':')[0])
94
+ st.image(dish_image, caption=dish.split(':')[0], use_column_width=True)
95
  else:
96
  st.write("No dishes found for the given ingredients.")
97
+
98