Download summarize.py from windycity/lowlight_agent: direct link, hf CLI and curl.
- Browser
- Download file 2.23 kB
-
https://huggingface.co/datasets/windycity/lowlight_agent/resolve/main/summarize.py
- Command line
-
hf download hf://datasets/windycity/lowlight_agent/summarize.py
-
curl -L -o summarize.py https://huggingface.co/datasets/windycity/lowlight_agent/resolve/main/summarize.py
2.23 kB
| """Create a compact index for AgenticIR batch output layouts.""" | |
| import argparse | |
| import csv | |
| import json | |
| from pathlib import Path | |
| def main(): | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument('--version', choices=('agenticir', 'light', 'v2', 'v3', 'v4', 'v4-psnr'), required=True) | |
| parser.add_argument('--output-dir', type=Path, required=True) | |
| args = parser.parse_args() | |
| root = args.output_dir.resolve() | |
| inputs = [line.strip() for line in (root / 'input_paths.txt').read_text().splitlines() if line.strip()] | |
| rows = [] | |
| for index, source in enumerate(inputs, 1): | |
| folder = root / f'{index:04d}' | |
| if args.version == 'agenticir': | |
| results = sorted(folder.glob('*/result.png')) | |
| summary_file = None | |
| else: | |
| results = [folder / 'result.png'] if (folder / 'result.png').is_file() else [] | |
| summary_file = (folder / 'summary.json' if args.version == 'light' | |
| else folder / 'logs/summary.json') | |
| summary = (json.loads(summary_file.read_text()) | |
| if summary_file and summary_file.is_file() else {}) | |
| rows.append({ | |
| 'index': index, | |
| 'input': source, | |
| 'complete': bool(results), | |
| 'result': str(results[0].relative_to(root)) if results else '', | |
| 'branch': summary.get('branch', ''), | |
| 'status': summary.get('status', ''), | |
| 'selected_tool': summary.get('selected_tool', ''), | |
| }) | |
| with (root / 'sample_index.csv').open('w', newline='', encoding='utf-8-sig') as stream: | |
| writer = csv.DictWriter(stream, fieldnames=rows[0].keys()) | |
| writer.writeheader() | |
| writer.writerows(rows) | |
| report = { | |
| 'version': args.version, | |
| 'inputs': len(rows), | |
| 'complete': sum(row['complete'] for row in rows), | |
| 'incomplete': sum(not row['complete'] for row in rows), | |
| 'final_images': 'See sample_index.csv; result paths are relative to this output directory.', | |
| } | |
| (root / 'run_summary.json').write_text(json.dumps(report, ensure_ascii=False, indent=2) + '\n') | |
| print(json.dumps(report, ensure_ascii=False), flush=True) | |
| if __name__ == '__main__': | |
| main() | |