Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -254,7 +254,6 @@ def display_response(response):
|
|
| 254 |
# Convert JSON string to dictionary if necessary
|
| 255 |
response = json.loads(response)
|
| 256 |
|
| 257 |
-
st.write("### Recipe Details")
|
| 258 |
st.write(f"**Name:** {response['name'].capitalize()}")
|
| 259 |
st.write(f"**Preparation Time:** {response['minutes']} minutes")
|
| 260 |
st.write(f"**Description:** {response['description'].capitalize()}")
|
|
@@ -318,6 +317,64 @@ with st.expander("**What is FOOD CHAIN?**"):
|
|
| 318 |
)
|
| 319 |
#################
|
| 320 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 321 |
col1, col2 = st.columns(2)
|
| 322 |
with col1:
|
| 323 |
st.title("Image Classification Result")
|
|
@@ -328,6 +385,7 @@ with col1:
|
|
| 328 |
st.markdown(f"*Donuts*: 98.11%")
|
| 329 |
with col2:
|
| 330 |
st.title('Results: RAG')
|
|
|
|
| 331 |
|
| 332 |
# Image Classification Section
|
| 333 |
if uploaded_image and recipe_submit:
|
|
|
|
| 254 |
# Convert JSON string to dictionary if necessary
|
| 255 |
response = json.loads(response)
|
| 256 |
|
|
|
|
| 257 |
st.write(f"**Name:** {response['name'].capitalize()}")
|
| 258 |
st.write(f"**Preparation Time:** {response['minutes']} minutes")
|
| 259 |
st.write(f"**Description:** {response['description'].capitalize()}")
|
|
|
|
| 317 |
)
|
| 318 |
#################
|
| 319 |
|
| 320 |
+
sample_RAG = {
|
| 321 |
+
"name": "Cinnamon Sugar Baked Donuts",
|
| 322 |
+
"minutes": 27,
|
| 323 |
+
"tags": [
|
| 324 |
+
"30-minutes-or-less",
|
| 325 |
+
"time-to-make",
|
| 326 |
+
"course",
|
| 327 |
+
"cuisine",
|
| 328 |
+
"preparation",
|
| 329 |
+
"occasion",
|
| 330 |
+
"north-american",
|
| 331 |
+
"healthy",
|
| 332 |
+
"desserts",
|
| 333 |
+
"american",
|
| 334 |
+
"dietary",
|
| 335 |
+
"comfort-food",
|
| 336 |
+
"taste-mood"
|
| 337 |
+
],
|
| 338 |
+
"n_steps": 10,
|
| 339 |
+
"description": "A delightful treat with a crusty sugar-cinnamon coating, perfect for a weekend breakfast or snack. Leftovers freeze well.",
|
| 340 |
+
"ingredients": [
|
| 341 |
+
"1 cup flour",
|
| 342 |
+
"1 teaspoon baking powder",
|
| 343 |
+
"1 teaspoon cinnamon",
|
| 344 |
+
"1/2 teaspoon nutmeg",
|
| 345 |
+
"1/4 teaspoon mace",
|
| 346 |
+
"1/4 teaspoon salt",
|
| 347 |
+
"1/2 cup sugar",
|
| 348 |
+
"1 egg",
|
| 349 |
+
"1/2 cup milk",
|
| 350 |
+
"2 tablespoons butter, melted",
|
| 351 |
+
"1 teaspoon vanilla",
|
| 352 |
+
"1/4 cup brown sugar"
|
| 353 |
+
],
|
| 354 |
+
"n_ingredients": 12,
|
| 355 |
+
"formatted_nutrition": [
|
| 356 |
+
"Calorie : 302.9 per serving",
|
| 357 |
+
"Total Fat : 11.0 % daily value",
|
| 358 |
+
"Sugar : 154.0 % daily value",
|
| 359 |
+
"Sodium : 9.0 % daily value",
|
| 360 |
+
"Protein : 7.0 % daily value",
|
| 361 |
+
"Saturated Fat : 22.0 % daily value",
|
| 362 |
+
"Total Carbohydrate : 18.0 % daily value"
|
| 363 |
+
],
|
| 364 |
+
"formatted_steps": [
|
| 365 |
+
"1. Mix all dry ingredients in a medium-size bowl",
|
| 366 |
+
"2. In a smaller bowl, beat the egg",
|
| 367 |
+
"3. Mix the egg with milk and melted butter",
|
| 368 |
+
"4. Add vanilla to the mixture",
|
| 369 |
+
"5. Stir the milk mixture into the dry ingredients until just combined, being careful not to overmix",
|
| 370 |
+
"6. Pour the batter into a greased donut baking tin, filling approximately 3/4 full",
|
| 371 |
+
"7. Mix cinnamon into brown sugar and sprinkle over the donuts",
|
| 372 |
+
"8. Drizzle or spoon melted butter over the top of each donut",
|
| 373 |
+
"9. Bake in a 350-degree oven for 17 minutes",
|
| 374 |
+
"10. Enjoy!"
|
| 375 |
+
]
|
| 376 |
+
}
|
| 377 |
+
|
| 378 |
col1, col2 = st.columns(2)
|
| 379 |
with col1:
|
| 380 |
st.title("Image Classification Result")
|
|
|
|
| 385 |
st.markdown(f"*Donuts*: 98.11%")
|
| 386 |
with col2:
|
| 387 |
st.title('Results: RAG')
|
| 388 |
+
display_response (sample_RAG)
|
| 389 |
|
| 390 |
# Image Classification Section
|
| 391 |
if uploaded_image and recipe_submit:
|