from pathlib import Path
from landingai_ade import LandingAIADE
# Initialize client (uses the API key from the VISION_AGENT_API_KEY environment variable)
client = LandingAIADE()
# Replace "data/" with your folder path
data_folder = Path("data/")
for filepath in data_folder.glob("*"):
# Adjust file types as needed for your use case
if filepath.suffix.lower() in ['.pdf', '.png', '.jpg', '.jpeg']:
print(f"Processing: {filepath.name}")
response = client.parse(
document=filepath,
model="dpt-2-latest"
)
print(response.chunks)
# Save markdown output (useful if you plan to run extract on the markdown)
output_md = filepath.stem + ".md"
with open(output_md, "w", encoding="utf-8") as f:
f.write(response.markdown)