Forgot to remove that
This commit is contained in:
@@ -2,7 +2,6 @@ import json
|
|||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
from APIs.aichat import generate
|
from APIs.aichat import generate
|
||||||
import shared.config as config
|
import shared.config as config
|
||||||
from PIL import Image, ImageEnhance
|
|
||||||
|
|
||||||
class UtensilMaterialCheck(BaseModel):
|
class UtensilMaterialCheck(BaseModel):
|
||||||
object_name: str = Field(
|
object_name: str = Field(
|
||||||
@@ -29,22 +28,6 @@ class DishSafetyResult(BaseModel):
|
|||||||
description="If is_safe is False, set to 'REMOVE METAL UTENSIL OR FOIL BEFORE MICROWAVING'. Otherwise empty ''."
|
description="If is_safe is False, set to 'REMOVE METAL UTENSIL OR FOIL BEFORE MICROWAVING'. Otherwise empty ''."
|
||||||
)
|
)
|
||||||
|
|
||||||
def preprocess_dish_image(image_path: str) -> str:
|
|
||||||
"""Brightens dark areas and sharpens food texture for small vision models."""
|
|
||||||
img = Image.open(image_path)
|
|
||||||
|
|
||||||
# 1. Boost brightness slightly
|
|
||||||
enhancer = ImageEnhance.Brightness(img)
|
|
||||||
img = enhancer.enhance(1.4)
|
|
||||||
|
|
||||||
# 2. Boost contrast to separate food shapes from dark shadows
|
|
||||||
enhancer = ImageEnhance.Contrast(img)
|
|
||||||
img = enhancer.enhance(1.3)
|
|
||||||
|
|
||||||
processed_path = "/tmp/processed_dish.jpg"
|
|
||||||
img.save(processed_path, quality=85)
|
|
||||||
return processed_path
|
|
||||||
|
|
||||||
def check_dish_safety(image_path: str) -> dict:
|
def check_dish_safety(image_path: str) -> dict:
|
||||||
prompt = (
|
prompt = (
|
||||||
"Analyze this microwave dish image strictly for EQUIPMENT DAMAGE HAZARDS (Metal, Steel, Aluminum Foil).\n\n"
|
"Analyze this microwave dish image strictly for EQUIPMENT DAMAGE HAZARDS (Metal, Steel, Aluminum Foil).\n\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user