INNER CODE UNIT · Python
update_readme
gokayfem/awesome-vlm-architectures · scripts/embed_architecture_figures.py:60
def update_readme(records: list[dict[str, object]]) -> None:
text = README.read_text(encoding="utf-8")
architecture_start = text.index("## Architectures")
important_start = text.index("## Important References", architecture_start)
prefix, architecture, suffix = (
text[:architecture_start],
text[architecture_start:important_start],
text[important_start:],
)
matches = list(re.finditer(r"(?m)^### \*\*(.+?)\*\*\s*$", architecture))
sections = [
architecture[
match.start() : matches[position + 1].start()
if position + 1 < len(matches)
else len(architecture)
]
for position, match in enumerate(matches)
]