ai_pdf/backend/pdf_to_mmd.py
Crizomb 11b92baaa8 * add conversion from pdf to latex-like (.mmd) format with nougat
* change vector_db_manager.py to handle .mmd
* add "conversion" tab
* add math mode checkbox in maintab
2024-04-18 08:00:03 +02:00

16 lines
337 B
Python

import subprocess
def pdf_to_mmd(path_input: str):
"""
Convert a PDF file to MMD format using the Nougat library
https://github.com/facebookresearch/nougat
stream stderr to the front end
"""
output_dir = "../documents/mmds"
command = ['nougat', path_input, "-o", output_dir]
subprocess.run(command)