Spaces:
Build error
Build error
Update app.py
Browse files3 unmodified lines456789101 unmodified line12131415161718192021223 unmodified lines262728293031323334353637383 unmodified lines4243444546474849505152533 unmodified linesimport os# import spaces #[uncomment to use ZeroGPU]from diffusers import AutoPipelineForText2Imageimport torchdevice = "cuda" if torch.cuda.is_available() else "cpu"1 unmodified lineif torch.cuda.is_available():torch_dtype = torch.float16else:torch_dtype = torch.float32pipe = pipeline = AutoPipelineForText2Image.from_pretrained("black-forest-labs/FLUX.1-dev", token=hf_token, torch_dtype=torch.bfloat16)pipe.load_lora_weights('aleksa-codes/flux-ghibsky-illustration', weight_name='lora.safetensors')pipe = pipe.to(device)MAX_SEED = np.iinfo(np.int32).max3 unmodified lines# @spaces.GPU #[uncomment to use ZeroGPU]def infer(prompt,negative_prompt,seed,randomize_seed,width,height,guidance_scale,num_inference_steps,progress=gr.Progress(track_tqdm=True),):if randomize_seed:3 unmodified linesimage = pipe(prompt=prompt,negative_prompt=negative_prompt,guidance_scale=guidance_scale,num_inference_steps=num_inference_steps,width=width,height=height,generator=generator,).images[0]return image, seed3 unmodified lines456789101 unmodified line12131415161718192021222324253 unmodified lines2930313233343536373839403 unmodified lines4445464748495051525354553 unmodified linesimport os# import spaces #[uncomment to use ZeroGPU]from diffusers import AutoPipelineForText2Image, AutoencoderKL, AutoencoderTinyimport torchdevice = "cuda" if torch.cuda.is_available() else "cpu"1 unmodified lineif torch.cuda.is_available():torch_dtype = torch.float16torch.cuda.empty_cache()else:torch_dtype = torch.float32taef1 = AutoencoderTiny.from_pretrained("madebyollin/taef1", torch_dtype=dtype).to(device)pipe = pipeline = AutoPipelineForText2Image.from_pretrained("black-forest-labs/FLUX.1-dev", token=hf_token, torch_dtype=torch.bfloat16)pipe.load_lora_weights('aleksa-codes/flux-ghibsky-illustration', weight_name='lora.safetensors')good_vae = AutoencoderKL.from_pretrained("black-forest-labs/FLUX.1-dev", subfolder="vae", torch_dtype=dtype).to(device)pipe = pipe.to(device)MAX_SEED = np.iinfo(np.int32).max3 unmodified lines# @spaces.GPU #[uncomment to use ZeroGPU]def infer(prompt,seed=42,randomize_seed=True,width=1024,height=1024,guidance_scale=3.5,num_inference_steps=28,progress=gr.Progress(track_tqdm=True),):if randomize_seed:3 unmodified linesimage = pipe(prompt=prompt,guidance_scale=guidance_scale,num_inference_steps=num_inference_steps,width=width,height=height,generator=generator,good_vae=good_vae,).images[0]return image, seed
app.py+11-9