fix: auto-fix code issues (cron)
- 修复重复导入/字段 - 修复异常处理 - 修复PEP8格式问题 - 添加类型注解
This commit is contained in:
@@ -33,7 +33,6 @@ try:
|
||||
except ImportError:
|
||||
PYTESSERACT_AVAILABLE = False
|
||||
|
||||
|
||||
@dataclass
|
||||
class ImageEntity:
|
||||
"""图片中检测到的实体"""
|
||||
@@ -43,7 +42,6 @@ class ImageEntity:
|
||||
confidence: float
|
||||
bbox: tuple[int, int, int, int] | None = None # (x, y, width, height)
|
||||
|
||||
|
||||
@dataclass
|
||||
class ImageRelation:
|
||||
"""图片中检测到的关系"""
|
||||
@@ -53,7 +51,6 @@ class ImageRelation:
|
||||
relation_type: str
|
||||
confidence: float
|
||||
|
||||
|
||||
@dataclass
|
||||
class ImageProcessingResult:
|
||||
"""图片处理结果"""
|
||||
@@ -69,7 +66,6 @@ class ImageProcessingResult:
|
||||
success: bool
|
||||
error_message: str = ""
|
||||
|
||||
|
||||
@dataclass
|
||||
class BatchProcessingResult:
|
||||
"""批量图片处理结果"""
|
||||
@@ -79,7 +75,6 @@ class BatchProcessingResult:
|
||||
success_count: int
|
||||
failed_count: int
|
||||
|
||||
|
||||
class ImageProcessor:
|
||||
"""图片处理器 - 处理各种类型图片"""
|
||||
|
||||
@@ -539,11 +534,9 @@ 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