code: def process_single_pdf(
      fname: str,
      out_folder: str,
      model_refs,
      metadata: Optional[Dict] = None,
      min_length: Optional[int] = None,
  ):
      out_filename = fname.rsplit(".", 1)[0] + ".md"
      out_filename = os.path.join(
          out_folder, os.path.basename(out_filename)
      )
      out_meta_filename = out_filename.rsplit(".", 1)[0] + "_meta.json"
      if os.path.exists(out_filename):
          return
      try:
          # Skip trying to convert files that don't have a lot of embedded text
          # This can indicate that they were scanned, and not OCRed properly
          # Usually these files are not recent/high-quality
          if min_length:
              length = get_length_of_text(fname)
              if length < min_length:
                  return
  
          full_text, out_metadata = convert_single_pdf(
              fname, model_refs, metadata=metadata
          )
          if len(full_text.strip()) > 0:
              with open(out_filename, "w+", encoding="utf-8") as f:
                  f.write(full_text)
              with open(out_meta_filename, "w+") as f:
                  f.write(json.dumps(out_metadata, indent=4))
          else:
              print(f"Empty file: {fname}.  Could not convert.")
      except Exception as e:
          print(f"Error converting {fname}: {e}")
          print(traceback.format_exc())
  
file_path: pdf-to-markdown/convert.py
imports: import argparse
  import os
  from typing import Dict, Optional
  import ray
  from tqdm import tqdm
  import math
  from marker.convert import convert_single_pdf, get_length_of_text
  from marker.models import load_all_models
  from marker.settings import settings
  from marker.logger import configure_logging
  import traceback
  import json
label_desc: Use image node_id 1 for calling a global function with example usage: process_single_pdf(fname, out_folder, model_refs, metadata, min_length) without return types