Spaces:
Runtime error
Runtime error
Update app.py
Browse files42 unmodified lines4344454647484950515253545556575859606162636465666730 unmodified lines9899100101102103104100 unmodified lines20520620720820921021142 unmodified lines# Image Editoredit_file = hf_hub_download(repo_id="stabilityai/cosxl", filename="cosxl_edit.safetensors")normal_file = hf_hub_download(repo_id="stabilityai/cosxl", filename="cosxl.safetensors")EDMEulerScheduler.set_timesteps = set_timesteps_patchedvae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)pipe_edit = StableDiffusionXLInstructPix2PixPipeline.from_single_file(edit_file, num_in_channels=8, is_cosxl_edit=True, vae=vae, torch_dtype=torch.float16,)pipe_edit.scheduler = EDMEulerScheduler(sigma_min=0.002, sigma_max=120.0, sigma_data=1.0, prediction_type="v_prediction")pipe_edit.to("cuda")from diffusers import StableDiffusionXLPipeline, EulerAncestralDiscreteSchedulerif not torch.cuda.is_available():DESCRIPTION += "\n<p>Running on CPU π₯Ά This demo may not work on CPU.</p>"device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")# Generator@spaces.GPU(duration=30, queue=False)def king(type ,30 unmodified linesgenerator = torch.Generator().manual_seed(seed)image = pipe(prompt = instruction,guidance_scale = guidance_scale,num_inference_steps = steps,width = width,height = height,100 unmodified linesinputs=[type,input_image, instruction],fn=king,outputs=[input_image],cache_examples=False,)gr.Markdown(help_text)42 unmodified lines434445464748495051525354555630 unmodified lines87888990919293100 unmodified lines19419519619719819920042 unmodified lines# Image Editoredit_file = hf_hub_download(repo_id="stabilityai/cosxl", filename="cosxl_edit.safetensors")EDMEulerScheduler.set_timesteps = set_timesteps_patchedvae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)pipe_edit = StableDiffusionXLInstructPix2PixPipeline.from_single_file(edit_file, num_in_channels=8, is_cosxl_edit=True, vae=vae, torch_dtype=torch.float16,)pipe_edit.scheduler = EDMEulerScheduler(sigma_min=0.002, sigma_max=120.0, sigma_data=1.0, prediction_type="v_prediction")pipe_edit.to("cuda")# Generator@spaces.GPU(duration=30, queue=False)def king(type ,30 unmodified linesgenerator = torch.Generator().manual_seed(seed)image = pipe(prompt = instruction,guidance_scale = 7,num_inference_steps = steps,width = width,height = height,100 unmodified linesinputs=[type,input_image, instruction],fn=king,outputs=[input_image],cache_examples=True,)gr.Markdown(help_text)
app.py+2-13