CTP-Project / INGREDIENT_RESTRICTIONS_UPDATE.md
AymanFahim's picture
Upload INGREDIENT_RESTRICTIONS_UPDATE.md
06c3d69 verified

A newer version of the Gradio SDK is available: 6.13.0

Upgrade

Ingredient Restrictions Update

βœ… Changes Made

1. Strict Ingredient Usage

  • Recipes now ONLY use detected ingredients (when ingredients are scanned)
  • No random ingredients will be added
  • Very clear and explicit instructions in the AI prompt

2. Flexible Combination

  • Recipes don't need to use all detected ingredients
  • Each of the 3 recipes uses a different combination of detected ingredients
  • More variety in recipe suggestions

3. Common Pantry Items Exception

Always allowed even if not detected:

  • Salt
  • Pepper / Black pepper
  • Olive oil / Vegetable oil / Cooking oil
  • Garlic / Onion
  • Garlic powder / Onion powder
  • Basic seasonings / Herbs / Common spices

4. Updated UI

  • Clear explanation of ingredient rules in the Recipe Generator tab
  • Shows what items are always allowed
  • Explains that recipes only use detected ingredients

πŸ“‹ How It Works

When Ingredients Are Detected:

Detected: ["chicken", "tomatoes", "pasta", "cheese"]

Recipe 1: Uses chicken + tomatoes + salt + pepper + oil
Recipe 2: Uses pasta + cheese + garlic + salt + pepper  
Recipe 3: Uses chicken + pasta + tomatoes + oil + seasonings

❌ Won't add: potatoes, rice, or any other non-detected items
βœ… Will add: salt, pepper, oil, garlic (common pantry items)

When No Ingredients Are Detected:

  • Falls back to flexible recipe generation
  • Uses common pantry items
  • Works as before

πŸ” Code Changes

Prompt Structure:

  1. STRICT INGREDIENT REQUIREMENTS section (when ingredients detected)

    • Lists detected ingredients
    • Lists allowed common pantry items
    • Explicitly forbids other ingredients
    • Emphasized multiple times in the prompt
  2. REMINDER section

    • Reinforces the restrictions
    • Makes it very clear what can and cannot be used

UI Updates:

  • Added ingredient rules explanation in description box
  • Added "With Detected Ingredients" section explaining the behavior
  • Clear messaging about common pantry items

🎯 Example

Input:

  • Detected ingredients: "chicken", "tomatoes", "rice"
  • Cuisine: "Italian"

Output:

  • Recipe 1: Chicken and Tomato Risotto (uses chicken + tomatoes + rice + salt + pepper + oil + garlic)
  • Recipe 2: Italian Chicken with Tomatoes (uses chicken + tomatoes + salt + pepper + herbs + oil)
  • Recipe 3: Tomato Rice Bowl (uses tomatoes + rice + garlic + oil + seasonings)

Key Points:

  • βœ… Only uses detected items + common pantry items
  • βœ… Each recipe has different combinations
  • βœ… No random ingredients added
  • βœ… Still practical and delicious!