Spaces:
Configuration error
Configuration error
add zerogpu dev
Browse filesFiles changed (2)
123451 unmodified line789910111213101112131415161718192021import gradio as grimport spacesimport torchimport torch.nn.functional as Ffrom diffusers import StableDiffusionPipeline, DPMSolverMultistepScheduler1 unmodified line
model_id = "stabilityai/stable-diffusion-2-1"
device = torch.device('cpu')dtype = torch.float32if torch.cuda.is_available(): device = torch.device('cuda') dtype = torch.float16device = torch.device('cuda')dtype = torch.float16
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=dtype)pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)pipe = pipe.to(device)
@spaces.GPUdef img_gen(prompt, seed, steps, cfg, down_from_768=False, progress=gr.Progress(track_tqdm=True)): generator = torch.Generator(device=device).manual_seed(int(seed)) hw = 512 if not down_from_768 else 768123456789910111213101112131411 unmodified lines26272829303132import imageioimport numpy as npimport spacesimport torchfrom diffusers import UniPCMultistepScheduler, StableDiffusionControlNetPipelinefrom diffusers.utils import get_class_from_dynamic_module
from tqdm import tqdm
device = torch.device('cpu')dtype = torch.float32if torch.cuda.is_available(): device = torch.device('cuda') dtype = torch.float16device = torch.device('cuda')dtype = torch.float16
NeuralTextureControlNetModel = get_class_from_dynamic_module( "dilightnet/model_helpers",11 unmodified linespipe.set_progress_bar_config(disable=True)
@spaces.GPUdef relighting_gen(masked_ref_img, mask, cond_path, frames, prompt, steps, seed, cfg): mask = mask[..., :1] / 255. for i in tqdm(range(frames)):demo/img_gen.py+4-5
demo/relighting_gen.py+4-5