Spaces:
Running on Zero
Running on Zero
File size: 513 Bytes
98e1d9f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | from __future__ import annotations
from pathlib import Path
def write_markdown_file(
text: str,
destination: Path,
language: str,
mode: str,
page_count: int,
) -> Path:
body = (text or "").strip()
header = (
f"# Document OCR\n\n"
f"- Language: `{language}`\n"
f"- Mode: `{mode}`\n"
f"- Pages: `{page_count}`\n\n"
f"---\n\n"
)
destination.write_text(header + body + "\n", encoding="utf-8")
return destination
|