Spaces:
Runtime error
Runtime error
Jean Yu commited on
Commit ·
e7abe49
1
Parent(s): caef638
Add denoise_steps to enable optimization via early stopped diffusion process
Browse files43 unmodified lines44454647484950515253545556575859606125 unmodified lines8788899091928 unmodified lines10110210310410510610710810911011111211311411511643 unmodified linesprompt: str,negative_prompt: str,guidance_scale: float = 5.0,seed: int = 0,randomize_seed: bool = True,):generator = torch.Generator() if randomize_seed else torch.manual_seed(seed)output = pipe(prompt,width=1024,height=512,negative_prompt=negative_prompt,guidance_scale=guidance_scale,generator=generator,num_inference_steps=50,) # type: ignorergb_image, depth_image = output.rgb[0], output.depth[0] # type: ignorewith NamedTemporaryFile(suffix=".png", delete=False, dir="tmp") as rgb_file:25 unmodified linesguidance_scale = gr.Slider(label="Guidance Scale", minimum=0, maximum=10, step=0.1, value=5.0)randomize_seed = gr.Checkbox(label="Randomize Seed", value=True)seed = gr.Slider(label="Seed", minimum=0,maximum=2**64 - 1, step=1)8 unmodified linesdepth = gr.Image(label="Depth Image", type="filepath")gr.Examples(examples=[["360 view of a large bedroom", "", 7.0, 42, False]],inputs=[prompt, negative_prompt, guidance_scale, seed, randomize_seed],outputs=[rgb, depth, generated_seed, html],fn=predict,cache_examples=True)new_btn.click(fn=predict,inputs=[prompt, negative_prompt, guidance_scale, seed, randomize_seed],outputs=[rgb, depth, generated_seed, html],)block.launch()43 unmodified lines4445464748495051525354555657585960616225 unmodified lines8889909192939495968 unmodified lines10510610710810911011111211311411511611711811912043 unmodified linesprompt: str,negative_prompt: str,guidance_scale: float = 5.0,denoise_steps: int = 50,seed: int = 0,randomize_seed: bool = True,):generator = torch.Generator() if randomize_seed else torch.manual_seed(seed)output = pipe(prompt,width=1024,height=512,negative_prompt=negative_prompt,guidance_scale=guidance_scale,generator=generator,num_inference_steps=denoise_steps,) # type: ignorergb_image, depth_image = output.rgb[0], output.depth[0] # type: ignorewith NamedTemporaryFile(suffix=".png", delete=False, dir="tmp") as rgb_file:25 unmodified linesguidance_scale = gr.Slider(label="Guidance Scale", minimum=0, maximum=10, step=0.1, value=5.0)denoise_steps = gr.Slider(label="Denoise Steps", minimum=25, maximum=250, step=25, value=50)randomize_seed = gr.Checkbox(label="Randomize Seed", value=True)seed = gr.Slider(label="Seed", minimum=0,maximum=2**64 - 1, step=1)8 unmodified linesdepth = gr.Image(label="Depth Image", type="filepath")gr.Examples(examples=[["360 view of a large bedroom", "", 7.0, 50, 42, False]],inputs=[prompt, negative_prompt, guidance_scale, denoise_steps, seed, randomize_seed],outputs=[rgb, depth, generated_seed, html],fn=predict,cache_examples=True)new_btn.click(fn=predict,inputs=[prompt, negative_prompt, guidance_scale, denoise_steps, seed, randomize_seed],outputs=[rgb, depth, generated_seed, html],)block.launch()
app.py+10-6