MCPcopy Create free account
hub / github.com/VitoHowe/glm-coding / build_prompt_chars

Function build_prompt_chars

app/services/tenvision_adapter.py:235–251  ·  view source on GitHub ↗
(items, image, engine)

Source from the content-addressed store, hash-verified

233 return prompt_item, chars
234
235 top_roi = image[: int(image.shape[0] * 0.14), :]
236 top_result = engine(top_roi)
237 top_items = ocr_items(top_result)
238 prompt_item = find_prompt_item(top_items, top_roi.shape[0], top_roi.shape[1])
239 if prompt_item is not None:
240 chars = parse_prompt_chars(prompt_item['text'])
241 if len(chars) >= 2:
242 return prompt_item, chars
243
244 raise RuntimeError('无法从 RapidOCR 结果中解析出提示字符。')
245
246
247def is_ignored_item(item, prompt_item, image_h, image_w):
248 text = item['text']
249 if not text:
250 return True
251 if text in IGNORE_TEXTS:
252 return True
253 if any(keyword in text for keyword in ('AI', '确定', '安全验证', '生成背景')):
254 return True

Callers 1

run_pipeline_bytesFunction · 0.85

Calls 3

find_prompt_itemFunction · 0.85
parse_prompt_charsFunction · 0.85
ocr_itemsFunction · 0.85

Tested by

no test coverage detected