2525
2626@app .command ()
2727def generate (
28- input : str = typer .Option (
29- ..., "--input" , "-i" , help = "Path to methodology text file"
30- ),
28+ input : str = typer .Option (..., "--input" , "-i" , help = "Path to methodology text file" ),
3129 caption : str = typer .Option (
3230 ..., "--caption" , "-c" , help = "Figure caption / communicative intent"
3331 ),
34- output : Optional [str ] = typer .Option (
35- None , "--output" , "-o" , help = "Output image path"
36- ),
32+ output : Optional [str ] = typer .Option (None , "--output" , "-o" , help = "Output image path" ),
3733 vlm_provider : Optional [str ] = typer .Option (
3834 None , "--vlm-provider" , help = "VLM provider (gemini)"
3935 ),
40- vlm_model : Optional [str ] = typer .Option (
41- None , "--vlm-model" , help = "VLM model name"
42- ),
36+ vlm_model : Optional [str ] = typer .Option (None , "--vlm-model" , help = "VLM model name" ),
4337 image_provider : Optional [str ] = typer .Option (
4438 None , "--image-provider" , help = "Image gen provider"
4539 ),
46- image_model : Optional [str ] = typer .Option (
47- None , "--image-model" , help = "Image gen model name"
48- ),
40+ image_model : Optional [str ] = typer .Option (None , "--image-model" , help = "Image gen model name" ),
4941 iterations : Optional [int ] = typer .Option (
5042 None , "--iterations" , "-n" , help = "Refinement iterations"
5143 ),
52- config : Optional [str ] = typer .Option (
53- None , "--config" , help = "Path to config YAML file"
54- ),
44+ config : Optional [str ] = typer .Option (None , "--config" , help = "Path to config YAML file" ),
5545):
5646 """Generate a methodology diagram from a text description."""
5747 # Load source text
@@ -81,6 +71,7 @@ def generate(
8171 settings = Settings .from_yaml (config , ** overrides )
8272 else :
8373 from dotenv import load_dotenv
74+
8475 load_dotenv ()
8576 settings = Settings (** overrides )
8677
@@ -91,13 +82,15 @@ def generate(
9182 diagram_type = DiagramType .METHODOLOGY ,
9283 )
9384
94- console .print (Panel .fit (
95- f"[bold]PaperBanana[/bold] - Generating Methodology Diagram\n \n "
96- f"VLM: { settings .vlm_provider } / { settings .vlm_model } \n "
97- f"Image: { settings .image_provider } / { settings .image_model } \n "
98- f"Iterations: { settings .refinement_iterations } " ,
99- border_style = "blue" ,
100- ))
85+ console .print (
86+ Panel .fit (
87+ f"[bold]PaperBanana[/bold] - Generating Methodology Diagram\n \n "
88+ f"VLM: { settings .vlm_provider } / { settings .vlm_model } \n "
89+ f"Image: { settings .image_provider } / { settings .image_model } \n "
90+ f"Iterations: { settings .refinement_iterations } " ,
91+ border_style = "blue" ,
92+ )
93+ )
10194
10295 # Run pipeline
10396 from paperbanana .core .pipeline import PaperBananaPipeline
@@ -135,8 +128,10 @@ def plot(
135128
136129 # Load data
137130 import json as json_mod
131+
138132 if data_path .suffix == ".csv" :
139133 import pandas as pd
134+
140135 df = pd .read_csv (data_path )
141136 raw_data = df .to_dict (orient = "records" )
142137 source_context = (
@@ -149,6 +144,7 @@ def plot(
149144 source_context = f"JSON data:\n { json_mod .dumps (raw_data , indent = 2 )[:2000 ]} "
150145
151146 from dotenv import load_dotenv
147+
152148 load_dotenv ()
153149
154150 settings = Settings (
@@ -163,12 +159,14 @@ def plot(
163159 raw_data = {"data" : raw_data },
164160 )
165161
166- console .print (Panel .fit (
167- f"[bold]PaperBanana[/bold] - Generating Statistical Plot\n \n "
168- f"Data: { data_path .name } \n "
169- f"Intent: { intent } " ,
170- border_style = "green" ,
171- ))
162+ console .print (
163+ Panel .fit (
164+ f"[bold]PaperBanana[/bold] - Generating Statistical Plot\n \n "
165+ f"Data: { data_path .name } \n "
166+ f"Intent: { intent } " ,
167+ border_style = "green" ,
168+ )
169+ )
172170
173171 from paperbanana .core .pipeline import PaperBananaPipeline
174172
@@ -183,16 +181,19 @@ async def _run():
183181@app .command ()
184182def setup ():
185183 """Interactive setup wizard — get generating in 2 minutes with FREE APIs."""
186- console .print (Panel .fit (
187- "[bold]Welcome to PaperBanana Setup[/bold]\n \n "
188- "We'll set up FREE API keys so you can start generating diagrams." ,
189- border_style = "yellow" ,
190- ))
184+ console .print (
185+ Panel .fit (
186+ "[bold]Welcome to PaperBanana Setup[/bold]\n \n "
187+ "We'll set up FREE API keys so you can start generating diagrams." ,
188+ border_style = "yellow" ,
189+ )
190+ )
191191
192192 console .print ("\n [bold]Step 1: Google Gemini API Key[/bold] (FREE, no credit card)" )
193193 console .print ("This powers the AI agents that plan and critique your diagrams.\n " )
194194
195195 import webbrowser
196+
196197 open_browser = Prompt .ask (
197198 "Open browser to get a free Gemini API key?" ,
198199 choices = ["y" , "n" ],
@@ -220,18 +221,10 @@ def setup():
220221
221222@app .command ()
222223def evaluate (
223- generated : str = typer .Option (
224- ..., "--generated" , "-g" , help = "Path to generated image"
225- ),
226- context : str = typer .Option (
227- ..., "--context" , help = "Path to source context text file"
228- ),
229- caption : str = typer .Option (
230- ..., "--caption" , "-c" , help = "Figure caption"
231- ),
232- reference : str = typer .Option (
233- ..., "--reference" , "-r" , help = "Path to human reference image"
234- ),
224+ generated : str = typer .Option (..., "--generated" , "-g" , help = "Path to generated image" ),
225+ context : str = typer .Option (..., "--context" , help = "Path to source context text file" ),
226+ caption : str = typer .Option (..., "--caption" , "-c" , help = "Figure caption" ),
227+ reference : str = typer .Option (..., "--reference" , "-r" , help = "Path to human reference image" ),
235228 vlm_provider : str = typer .Option (
236229 "gemini" , "--vlm-provider" , help = "VLM provider for evaluation"
237230 ),
@@ -252,10 +245,12 @@ def evaluate(
252245 context_text = Path (context ).read_text (encoding = "utf-8" )
253246
254247 from dotenv import load_dotenv
248+
255249 load_dotenv ()
256250
257251 settings = Settings (vlm_provider = vlm_provider )
258252 from paperbanana .providers .registry import ProviderRegistry
253+
259254 vlm = ProviderRegistry .create_vlm (settings )
260255
261256 judge = VLMJudge (vlm )
@@ -276,12 +271,14 @@ async def _run():
276271 result = getattr (scores , dim )
277272 dim_lines .append (f"{ dim .capitalize ():14s} { result .winner } " )
278273
279- console .print (Panel .fit (
280- "[bold]Evaluation Results (Comparative)[/bold]\n \n "
281- + "\n " .join (dim_lines )
282- + f"\n [bold]{ 'Overall' :14s} { scores .overall_winner } [/bold]" ,
283- border_style = "cyan" ,
284- ))
274+ console .print (
275+ Panel .fit (
276+ "[bold]Evaluation Results (Comparative)[/bold]\n \n "
277+ + "\n " .join (dim_lines )
278+ + f"\n [bold]{ 'Overall' :14s} { scores .overall_winner } [/bold]" ,
279+ border_style = "cyan" ,
280+ )
281+ )
285282
286283 for dim in dims :
287284 result = getattr (scores , dim )
0 commit comments