diff --git a/cloud/app.py b/cloud/app.py index 98e57ae..75b657e 100644 --- a/cloud/app.py +++ b/cloud/app.py @@ -605,7 +605,7 @@ def debug_unsafe_dish(): def debug_safe_dish(): """Debug endpoint to simulate a safe dish scenario.""" # Simulated safe dish data - unsafe_dish = "storage/dishPhotos/dish_def0047482e6430488dbf9a47d73271a.jpg" + unsafe_dish = "storage/dishPhotos/dish_af60c26a08a74ce894d453394f417c22.jpg" # Call the cooking_params endpoint logic directly return safety_checker.check_dish_safety(unsafe_dish) diff --git a/cloud/safety_checker.py b/cloud/safety_checker.py index 08d8157..c31d7f4 100644 --- a/cloud/safety_checker.py +++ b/cloud/safety_checker.py @@ -7,14 +7,11 @@ class DishSafetyResult(BaseModel): visible_objects: list[str] = Field( description="List EVERY distinct item visible in the frame (e.g., ['ceramic bowl', 'rice', 'metal spoon handle', 'stew'])." ) - spoon_or_utensil_present: bool = Field( - description="Set to True if ANY metal, plastic, or wooden spoon, fork, knife, or utensil is present anywhere in or around the container." - ) is_safe: bool = Field( - description="Set to False if spoon_or_utensil_present is True, or if aluminum foil or metal is present. Set to True ONLY if pure food/bowl with zero utensils." + description="Is the microwave dish safe to microwave? True if safe, False if unsafe." ) detected_hazards: list[str] = Field( - description="List ONLY physical hazard items found (e.g., ['metal spoon']). Empty list [] if safe." + description="List ONLY physical hazard items found. Empty list [] if safe." ) warning_message: str = Field( description="Warning statement if unsafe, otherwise empty string ''." @@ -24,11 +21,8 @@ def check_dish_safety(image_path: str) -> dict: prompt = ( "You are an expert microwave safety quality inspector analyzing a top-down camera frame.\n\n" "INSPECTION STEPS:\n" - "1. Carefully examine the perimeter, edges, and inner cavity of the bowl/container.\n" - "2. Identify any utensil handles (spoons, forks, knives) protruding from or resting in the dish, regardless of shadow or reflectivity.\n" - "3. List all visible items in `visible_objects` first.\n" - "4. If a utensil or metal object is present anywhere, `spoon_or_utensil_present` MUST be True and `is_safe` MUST be False.\n" - "5. `is_safe` is True ONLY if the container holds strictly food with no utensils or metal." + "Describe what you see in the image, identify any potential hazards, and determine if the dish is safe to microwave.\n\n" + "Alert only if the cooking of the dish will cause damage to the microwave or the dish itself." ) response_raw = generate(