@@ -87,8 +87,16 @@ def download_image(image_url: str):
8787
8888@app .command ()
8989def generate (
90- client_id : str = typer .Option (..., help = "Your Adobe Firefly client ID" ),
91- client_secret : str = typer .Option (..., help = "Your Adobe Firefly client secret" ),
90+ client_id : str = typer .Option (
91+ None ,
92+ help = "Your Adobe Firefly client ID" ,
93+ envvar = ["FIREFLY_CLIENT_ID" ],
94+ ),
95+ client_secret : str = typer .Option (
96+ None ,
97+ help = "Your Adobe Firefly client secret" ,
98+ envvar = ["FIREFLY_CLIENT_SECRET" ],
99+ ),
92100 prompt : str = typer .Option (..., help = "Text prompt for image generation" ),
93101 download : bool = typer .Option (False , help = "Download the generated image to a file (filename is taken from the image URL)" ),
94102 show_images : bool = typer .Option (False , help = "Display the image in the terminal after download." ),
@@ -99,6 +107,10 @@ def generate(
99107 """
100108 Generate an image from a text prompt using Adobe Firefly API.
101109 """
110+ if not client_id :
111+ raise typer .BadParameter ("client_id must be provided as an option or via the FIREFLY_CLIENT_ID environment variable." )
112+ if not client_secret :
113+ raise typer .BadParameter ("client_secret must be provided as an option or via the FIREFLY_CLIENT_SECRET environment variable." )
102114 with with_maybe_use_mocks (use_mocks ):
103115 _generate (client_id , client_secret , prompt , download , show_images , format , verbose )
104116
0 commit comments