From 7eb02be989f2594ce1ff9654fc9cdc34d9573387 Mon Sep 17 00:00:00 2001 From: Marc Abramowitz Date: Thu, 22 May 2025 15:35:02 -0700 Subject: [PATCH] Update README to include CLI usage and options for image generation --- README.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d327818..41b7eaf 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Adobe Firefly Python Client +# Adobe Firefly Python Client Library & CLI [![CI](https://github.com/msabramo/python-firefly/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/msabramo/python-firefly/actions/workflows/ci.yml) @@ -43,6 +43,54 @@ print("Content class:", response.contentClass) - Generate an image from a text prompt. Returns a response object with attributes matching the API response (including outputs, size, contentClass, etc). - Additional keyword arguments are passed as parameters to the API. +## Command Line Interface (CLI) + +The `firefly` CLI allows you to generate images from the command line using the Adobe Firefly API. + +### Usage + +```sh +export FIREFLY_CLIENT_ID="abc123" +export FIREFLY_CLIENT_SECRET="xyz456" +``` + +```sh +firefly image generate \ + --prompt="a realistic illustration of a cat coding" \ + --show-images +``` + +### Options + +- `--client-id TEXT` Your Adobe Firefly client ID [env var: FIREFLY_CLIENT_ID] [default: None] +- `--client-secret TEXT` Your Adobe Firefly client secret [env var: FIREFLY_CLIENT_SECRET] [default: None] +- `--prompt TEXT` * Text prompt for image generation [required] +- `--num-variations INTEGER` Number of images to generate (numVariations) [default: None] +- `--style TEXT` Style object as JSON string (presets, imageReference, strength, etc.) [default: None] +- `--structure TEXT` Structure object as JSON string (strength, imageReference, etc.) [default: None] +- `--prompt-biasing-locale-code TEXT` Locale code for prompt biasing (promptBiasingLocaleCode), e.g., en-US, en-IN, zh-CN [default: None] +- `--negative-prompt TEXT` Negative prompt to avoid certain content [default: None] +- `--seed INTEGER` Seed for deterministic output [default: None] +- `--aspect-ratio TEXT` Aspect ratio, e.g. '1:1', '16:9' [default: None] +- `--output-format TEXT` Output format, e.g. 'jpeg', 'png' [default: None] +- `--content-class TEXT` Content class: 'photo' or 'art' [default: None] +- `--download/--no-download` Download the generated image to a file (filename is taken from the image URL) [default: no-download] +- `--show-images/--no-show-images` Display the image in the terminal after download. [default: no-show-images] +- `--use-mocks/--no-use-mocks` Mock API responses for testing without a valid client secret. [default: no-use-mocks] +- `--format TEXT` Output format: 'text' (default) or 'json' for pretty-printed JSON response. [default: text] +- `--verbose/--no-verbose` Print status messages to stderr. [default: no-verbose] +- `--help` Show this message and exit + +### Example + +```sh +firefly image generate \ + --prompt="a futuristic city skyline at sunset" \ + --show-images +``` + +The CLI will print the generated image URL. + ## Error Handling - `FireflyAuthError`: Raised for authentication/token errors @@ -52,4 +100,4 @@ print("Content class:", response.contentClass) - [Adobe Firefly API Documentation] -[Adobe Firefly API Documentation]: https://developer.adobe.com/firefly-services/docs/firefly-api/guides/#generate-an-image \ No newline at end of file +[Adobe Firefly API Documentation]: https://developer.adobe.com/firefly-services/docs/firefly-api/guides/#generate-an-image