Commit d7cdc1a3 authored by wuzekai's avatar wuzekai

Update ocr.py

parent 57218e7b
Pipeline #575 canceled with stages
......@@ -52,4 +52,14 @@ def ocr_inference():
# 提取调试信息
debug_lines = result.stdout.splitlines()
pattern = re.compile(r"\[.*\] ppocr DEBUG: (.*?), (\d+\.\d+)")
results = []
\ No newline at end of file
results = []
for line in debug_lines:
match = pattern.search(line)
if match:
text = match.group(1).strip()
confidence = float(match.group(2))
results.append({"text": text, "confidence": confidence})
if not results:
return jsonify({"error": "No valid OCR debug output found"}), 500
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment