Files
fotoplaner/venv/lib/python3.12/site-packages/rapidocr/utils/to_json.py
T
anders 16c54c6653 Tilføjet venv med docling og afhængigheder
Testfiler opdelt i PNG og previews
2026-10-27 12:20:23 +01:00

18 lines
462 B
Python

# -*- encoding: utf-8 -*-
# @Author: SWHL
# @Contact: liekkaskono@163.com
from typing import Any, Dict, List, Tuple
import numpy as np
class ToJSON:
@classmethod
def to(
cls, boxes: np.ndarray, txts: Tuple[str], scores: Tuple[float]
) -> List[Dict[Any, Any]]:
results = []
for box, txt, score in zip(boxes, txts, scores):
results.append({"box": box.tolist(), "txt": txt, "score": score})
return results