Spaces:
Runtime error
Runtime error
Add an option to sample random seed
Browse files52 unmodified lines53545556575824 unmodified lines83848586878889909152 unmodified linesstep=1,value=20,label='Number of Steps')seed = gr.Slider(0,100000,step=1,24 unmodified linesmodel_name,scheduler_type,num_steps,seed,],outputs=result)return demo52 unmodified lines535455565758596024 unmodified lines8586878889909192939495969752 unmodified linesstep=1,value=20,label='Number of Steps')randomize_seed = gr.Checkbox(value=False,label='Randomize Seed')seed = gr.Slider(0,100000,step=1,24 unmodified linesmodel_name,scheduler_type,num_steps,randomize_seed,seed,],outputs=[result,seed,])return demo
105 unmodified lines106107108109110111112113114115116117105 unmodified linesmodel_name: str,scheduler_type: str,num_steps: int,seed: int,) -> PIL.Image.Image:self.set_pipeline(model_name, scheduler_type)if scheduler_type == 'PNDM':num_steps = max(4, min(num_steps, 100))return self.generate(seed, num_steps)[0]@staticmethoddef to_grid(images: list[PIL.Image.Image],105 unmodified lines106107108109110111112113114115116117118119120105 unmodified linesmodel_name: str,scheduler_type: str,num_steps: int,randomize_seed: bool,seed: int,) -> tuple[PIL.Image.Image, int]:self.set_pipeline(model_name, scheduler_type)if scheduler_type == 'PNDM':num_steps = max(4, min(num_steps, 100))if randomize_seed:seed = self.rng.randint(0, 100000)return self.generate(seed, num_steps)[0], seed@staticmethoddef to_grid(images: list[PIL.Image.Image],
app.py+7-1
model.py+5-2