MCPcopy Index your code
hub / github.com/sml2h3/ddddocr / OCRRequest

Class OCRRequest

ddddocr/api/app.py:133–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131 return _validate_base64_payload(value, 'image')
132
133class OCRRequest(Base64Image):
134 probability: bool = Field(False, description="是否返回识别概率")
135 colors: List[str] = Field(default_factory=list, description="颜色过滤列表")
136 custom_color_ranges: Optional[Dict[str, List[List[int]]]] = Field(None, description="自定义颜色范围")
137
138 @field_validator('colors')
139 def validate_colors(cls, value):
140 if value is None:
141 return []
142 if not isinstance(value, list):
143 raise ValueError('colors 必须是字符串列表')
144 normalized = []
145 for item in value:
146 if not isinstance(item, str):
147 raise ValueError('colors 中的元素必须是字符串')
148 stripped = item.strip()
149 if not stripped:
150 raise ValueError('colors 不允许包含空字符串')
151 normalized.append(stripped)
152 return normalized
153
154 @field_validator('custom_color_ranges')
155 def validate_custom_ranges(cls, value):
156 if value is None:
157 return value
158 return _validate_custom_range_dict(value)
159
160class SlideMatchRequest(BaseModel):
161 target_image: str = Field(..., description="目标图片的Base64编码")

Callers 1

call_toolMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…