Skip to content

Commit

Permalink
black
Browse files Browse the repository at this point in the history
  • Loading branch information
multimodalart committed Aug 30, 2024
1 parent 9f65cb9 commit 25625a8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docker_images/diffusers/app/pipelines/text_to_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,20 +160,20 @@ def __call__(self, inputs: str, **kwargs) -> "Image.Image":
def _process_req(self, inputs, **kwargs):
# only one image per prompt is supported
kwargs["num_images_per_prompt"] = 1

if "num_inference_steps" not in kwargs:
default_num_steps = os.getenv("DEFAULT_NUM_INFERENCE_STEPS")
if default_num_steps:
kwargs["num_inference_steps"] = int(default_num_steps)
elif self.is_karras_compatible:
kwargs["num_inference_steps"] = 20
# Else, don't specify anything, leave the default behaviour

if "seed" in kwargs:
seed = int(kwargs["seed"])
generator = torch.Generator().manual_seed(kwargs["seed"])
kwargs["generator"] = generator
kwargs.pop("seed")

images = self.ldm(inputs, **kwargs)["images"]
return images[0]

0 comments on commit 25625a8

Please sign in to comment.