Spaces:
Paused
Paused
Update app.py
Browse files28 unmodified lines29303132333414 unmodified lines4950515253545556575859606162632 unmodified lines666768697071723 unmodified lines76777879808128 unmodified lines# Inference function (maps to CLIPTextEncode + EmptySD3LatentImage + KSampler + VAEDecode)# ---------------------------------------------------------------------@spaces.GPUdef generate_images(positive: str,negative: str,14 unmodified linesimages = []# Base seed logic; if seed < 0, random base, else deterministic seriesif seed < 0:base_seed = torch.randint(0, 2**63 - 1, (1,), device=run_device).item()else:base_seed = int(seed)for i in range(num_images):this_seed = base_seed if seed < 0 else base_seed + igenerator = torch.Generator(device=run_device).manual_seed(this_seed)out = pipe(prompt=positive,2 unmodified linesheight=height,num_inference_steps=steps,guidance_scale=float(cfg),num_images_per_prompt=1, # always 1 for AOTI safetygenerator=generator,).images[0]3 unmodified lines# ---------------------------------------------------------------------# Gradio UI (inputs correspond to Comfy node widgets_values)# ---------------------------------------------------------------------28 unmodified lines2930313233343514 unmodified lines505152535455565758596061626364656667682 unmodified lines717273747576773 unmodified lines8182838485868728 unmodified lines# Inference function (maps to CLIPTextEncode + EmptySD3LatentImage + KSampler + VAEDecode)# ---------------------------------------------------------------------@spaces.GPU@spaces.GPUdef generate_images(positive: str,negative: str,14 unmodified linesimages = []# seed >= 0 -> deterministic series: seed, seed+1, ...# seed < 0 -> fully random seeds per imagefixed_base_seed = int(seed) if seed >= 0 else Nonefor i in range(num_images):if fixed_base_seed is None:# random seed for this imagethis_seed = torch.randint(0, 2**63 - 1, (1,), device=run_device).item()else:# deterministic offsetthis_seed = fixed_base_seed + igenerator = torch.Generator(device=run_device).manual_seed(int(this_seed))out = pipe(prompt=positive,2 unmodified linesheight=height,num_inference_steps=steps,guidance_scale=float(cfg),num_images_per_prompt=1,generator=generator,).images[0]3 unmodified lines# ---------------------------------------------------------------------# Gradio UI (inputs correspond to Comfy node widgets_values)# ---------------------------------------------------------------------
app.py+14-8