diff --git a/docs/user_guide/examples/offline_inference/text_to_image.md b/docs/user_guide/examples/offline_inference/text_to_image.md index fbc62526b..cf5cdf860 100644 --- a/docs/user_guide/examples/offline_inference/text_to_image.md +++ b/docs/user_guide/examples/offline_inference/text_to_image.md @@ -23,6 +23,23 @@ if __name__ == "__main__": images[0].save("coffee.png") ``` +Or put more than one prompt in a request, processing them sequentially. + +```python +from vllm_omni.entrypoints.omni import Omni + +if __name__ == "__main__": + omni = Omni(model="Qwen/Qwen-Image") + prompts = [ + "a cup of coffee on a table", + "a toy dinosaur on a sandy beach", + "a fox waking up in bed and yawning", + ] + outputs = omni.generate(prompts) + for i, output in enumerate(outputs): + image = output.request_output[0]["images"][0].save(f"{i}.jpg") +``` + ## Local CLI Usage ```bash diff --git a/examples/offline_inference/text_to_image/README.md b/examples/offline_inference/text_to_image/README.md index 21358f333..2403c4139 100644 --- a/examples/offline_inference/text_to_image/README.md +++ b/examples/offline_inference/text_to_image/README.md @@ -5,6 +5,8 @@ This folder provides several entrypoints for experimenting with `Qwen/Qwen-Image - `text_to_image.py`: command-line script for single image generation with advanced options. - `web_demo.py`: lightweight Gradio UI for interactive prompt/seed/CFG exploration. +Note that when you pass in multiple independent prompts, they will be processed sequentially. Batching requests is currently not supported. + ## Basic Usage ```python @@ -18,6 +20,23 @@ if __name__ == "__main__": images[0].save("coffee.png") ``` +Or put more than one prompt in a request, processing them sequentially. + +```python +from vllm_omni.entrypoints.omni import Omni + +if __name__ == "__main__": + omni = Omni(model="Qwen/Qwen-Image") + prompts = [ + "a cup of coffee on a table", + "a toy dinosaur on a sandy beach", + "a fox waking up in bed and yawning", + ] + outputs = omni.generate(prompts) + for i, output in enumerate(outputs): + image = output.request_output[0]["images"][0].save(f"{i}.jpg") +``` + ## Local CLI Usage ```bash