55import asyncio
66import time
77from abc import ABC , abstractmethod
8- from typing import Optional
98
109from PIL import Image
1110
@@ -25,8 +24,8 @@ class BaseCheck(ABC):
2524
2625 def __init__ (
2726 self ,
28- threshold : Optional [ float ] = None ,
29- judge : Optional [ str ] = None ,
27+ threshold : float | None = None ,
28+ judge : str | None = None ,
3029 ):
3130 self .threshold = threshold if threshold is not None else self .default_threshold
3231 self ._judge_override = judge
@@ -36,7 +35,7 @@ async def evaluate(
3635 self ,
3736 image : Image .Image ,
3837 prompt : str ,
39- judge : Optional [ Judge ] = None ,
38+ judge : Judge | None = None ,
4039 ) -> CheckResult :
4140 """Run the check on an image. Subclasses implement the logic."""
4241 ...
@@ -49,7 +48,7 @@ async def arun(
4948 self ,
5049 image : ImageInput ,
5150 prompt : str = "" ,
52- judge : Optional [ Judge ] = None ,
51+ judge : Judge | None = None ,
5352 ) -> CheckResult :
5453 """Async entry point that handles image loading and timing."""
5554 start = time .monotonic ()
@@ -75,7 +74,7 @@ async def evaluate(
7574 self ,
7675 image : Image .Image ,
7776 prompt : str ,
78- judge : Optional [ Judge ] = None ,
77+ judge : Judge | None = None ,
7978 ) -> CheckResult :
8079 """Standard VLM evaluation flow: build prompt -> call judge -> parse."""
8180 if judge is None :
@@ -85,9 +84,7 @@ async def evaluate(
8584 judge = get_judge (judge_name )
8685
8786 check_prompt = self .get_check_prompt (prompt )
88- response = await judge .evaluate (
89- image = image , prompt = prompt , check_prompt = check_prompt
90- )
87+ response = await judge .evaluate (image = image , prompt = prompt , check_prompt = check_prompt )
9188 return self ._parse_response (response )
9289
9390 def _parse_response (self , response : JudgeResponse ) -> CheckResult :
0 commit comments