fix: auto-fix code issues (cron)
- 修复重复导入/字段 - 修复异常处理 - 修复PEP8格式问题 (E302, E305, E501) - 修复行长度超过100字符的问题 - 修复F821未定义名称错误
This commit is contained in:
@@ -36,6 +36,7 @@ try:
|
||||
except ImportError:
|
||||
PYTESSERACT_AVAILABLE = False
|
||||
|
||||
|
||||
@dataclass
|
||||
class ImageEntity:
|
||||
"""图片中检测到的实体"""
|
||||
@@ -45,6 +46,7 @@ class ImageEntity:
|
||||
confidence: float
|
||||
bbox: tuple[int, int, int, int] | None = None # (x, y, width, height)
|
||||
|
||||
|
||||
@dataclass
|
||||
class ImageRelation:
|
||||
"""图片中检测到的关系"""
|
||||
@@ -54,6 +56,7 @@ class ImageRelation:
|
||||
relation_type: str
|
||||
confidence: float
|
||||
|
||||
|
||||
@dataclass
|
||||
class ImageProcessingResult:
|
||||
"""图片处理结果"""
|
||||
@@ -69,6 +72,7 @@ class ImageProcessingResult:
|
||||
success: bool
|
||||
error_message: str = ""
|
||||
|
||||
|
||||
@dataclass
|
||||
class BatchProcessingResult:
|
||||
"""批量图片处理结果"""
|
||||
@@ -78,6 +82,7 @@ class BatchProcessingResult:
|
||||
success_count: int
|
||||
failed_count: int
|
||||
|
||||
|
||||
class ImageProcessor:
|
||||
"""图片处理器 - 处理各种类型图片"""
|
||||
|
||||
@@ -551,9 +556,11 @@ class ImageProcessor:
|
||||
print(f"Thumbnail generation error: {e}")
|
||||
return image_data
|
||||
|
||||
|
||||
# Singleton instance
|
||||
_image_processor = None
|
||||
|
||||
|
||||
def get_image_processor(temp_dir: str = None) -> ImageProcessor:
|
||||
"""获取图片处理器单例"""
|
||||
global _image_processor
|
||||
|
||||
Reference in New Issue
Block a user