Tried my own
This commit is contained in:
+1
-1
@@ -605,7 +605,7 @@ def debug_unsafe_dish():
|
|||||||
def debug_safe_dish():
|
def debug_safe_dish():
|
||||||
"""Debug endpoint to simulate a safe dish scenario."""
|
"""Debug endpoint to simulate a safe dish scenario."""
|
||||||
# Simulated safe dish data
|
# 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
|
# Call the cooking_params endpoint logic directly
|
||||||
return safety_checker.check_dish_safety(unsafe_dish)
|
return safety_checker.check_dish_safety(unsafe_dish)
|
||||||
|
|||||||
+4
-10
@@ -7,14 +7,11 @@ class DishSafetyResult(BaseModel):
|
|||||||
visible_objects: list[str] = Field(
|
visible_objects: list[str] = Field(
|
||||||
description="List EVERY distinct item visible in the frame (e.g., ['ceramic bowl', 'rice', 'metal spoon handle', 'stew'])."
|
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(
|
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(
|
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(
|
warning_message: str = Field(
|
||||||
description="Warning statement if unsafe, otherwise empty string ''."
|
description="Warning statement if unsafe, otherwise empty string ''."
|
||||||
@@ -24,11 +21,8 @@ def check_dish_safety(image_path: str) -> dict:
|
|||||||
prompt = (
|
prompt = (
|
||||||
"You are an expert microwave safety quality inspector analyzing a top-down camera frame.\n\n"
|
"You are an expert microwave safety quality inspector analyzing a top-down camera frame.\n\n"
|
||||||
"INSPECTION STEPS:\n"
|
"INSPECTION STEPS:\n"
|
||||||
"1. Carefully examine the perimeter, edges, and inner cavity of the bowl/container.\n"
|
"Describe what you see in the image, identify any potential hazards, and determine if the dish is safe to microwave.\n\n"
|
||||||
"2. Identify any utensil handles (spoons, forks, knives) protruding from or resting in the dish, regardless of shadow or reflectivity.\n"
|
"Alert only if the cooking of the dish will cause damage to the microwave or the dish itself."
|
||||||
"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."
|
|
||||||
)
|
)
|
||||||
|
|
||||||
response_raw = generate(
|
response_raw = generate(
|
||||||
|
|||||||
Reference in New Issue
Block a user