@@ -556,11 +556,13 @@ def batch(
556556 settings = Settings .from_yaml (config , ** overrides )
557557 else :
558558 from dotenv import load_dotenv
559+
559560 load_dotenv ()
560561 settings = Settings (** overrides )
561562
562563 if auto_download_data :
563564 from paperbanana .data .manager import DatasetManager
565+
564566 dm = DatasetManager (cache_dir = settings .cache_dir )
565567 if not dm .is_downloaded ():
566568 console .print (" [dim]Downloading expanded reference set...[/dim]" )
@@ -590,14 +592,16 @@ def batch(
590592 input_path = Path (item ["input" ])
591593 if not input_path .exists ():
592594 console .print (f"[red]Skipping item '{ item_id } ': input not found: { input_path } [/red]" )
593- report ["items" ].append ({
594- "id" : item_id ,
595- "input" : item ["input" ],
596- "caption" : item ["caption" ],
597- "run_id" : None ,
598- "output_path" : None ,
599- "error" : "input file not found" ,
600- })
595+ report ["items" ].append (
596+ {
597+ "id" : item_id ,
598+ "input" : item ["input" ],
599+ "caption" : item ["caption" ],
600+ "run_id" : None ,
601+ "output_path" : None ,
602+ "error" : "input file not found" ,
603+ }
604+ )
601605 continue
602606 source_context = input_path .read_text (encoding = "utf-8" )
603607 gen_input = GenerationInput (
@@ -609,25 +613,29 @@ def batch(
609613 pipeline = PaperBananaPipeline (settings = settings )
610614 try :
611615 result = asyncio .run (pipeline .generate (gen_input ))
612- report ["items" ].append ({
613- "id" : item_id ,
614- "input" : item ["input" ],
615- "caption" : item ["caption" ],
616- "run_id" : result .metadata .get ("run_id" ),
617- "output_path" : result .image_path ,
618- "iterations" : len (result .iterations ),
619- })
616+ report ["items" ].append (
617+ {
618+ "id" : item_id ,
619+ "input" : item ["input" ],
620+ "caption" : item ["caption" ],
621+ "run_id" : result .metadata .get ("run_id" ),
622+ "output_path" : result .image_path ,
623+ "iterations" : len (result .iterations ),
624+ }
625+ )
620626 console .print (f" [green]✓[/green] [dim]{ result .image_path } [/dim]\n " )
621627 except Exception as e :
622628 console .print (f" [red]✗[/red] { e } \n " )
623- report ["items" ].append ({
624- "id" : item_id ,
625- "input" : item ["input" ],
626- "caption" : item ["caption" ],
627- "run_id" : None ,
628- "output_path" : None ,
629- "error" : str (e ),
630- })
629+ report ["items" ].append (
630+ {
631+ "id" : item_id ,
632+ "input" : item ["input" ],
633+ "caption" : item ["caption" ],
634+ "run_id" : None ,
635+ "output_path" : None ,
636+ "error" : str (e ),
637+ }
638+ )
631639
632640 total_elapsed = time .perf_counter () - total_start
633641 report ["total_seconds" ] = round (total_elapsed , 1 )
0 commit comments