Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -114,10 +114,9 @@ def genie (Model, Prompt, negative_prompt, height, width, scale, steps, seed, up
|
|
114 |
sdxl = sdxl.to(device)
|
115 |
sdxl.enable_xformers_memory_efficient_attention()
|
116 |
torch.cuda.empty_cache()
|
117 |
-
|
118 |
-
torch.cuda.empty_cache()
|
119 |
-
|
120 |
if upscale == "Yes":
|
|
|
121 |
sdxl = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-refiner-1.0", use_safetensors=True, torch_dtype=torch.float16, variant="fp16") if torch.cuda.is_available() else DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-refiner-1.0")
|
122 |
sdxl.enable_xformers_memory_efficient_attention()
|
123 |
sdxl = sdxl.to(device)
|
@@ -125,7 +124,10 @@ def genie (Model, Prompt, negative_prompt, height, width, scale, steps, seed, up
|
|
125 |
refined = sdxl(Prompt, negative_prompt=negative_prompt, image=int_image, denoising_start=high_noise_frac).images[0]
|
126 |
torch.cuda.empty_cache()
|
127 |
return refined
|
128 |
-
|
|
|
|
|
|
|
129 |
return image
|
130 |
|
131 |
gr.Interface(fn=genie, inputs=[gr.Radio(['PhotoReal', 'Anime', 'Disney', 'StoryBook', 'SemiReal', 'Animagine XL 3.0', 'SDXL 1.0'], value='PhotoReal', label='Choose Model'),
|
|
|
114 |
sdxl = sdxl.to(device)
|
115 |
sdxl.enable_xformers_memory_efficient_attention()
|
116 |
torch.cuda.empty_cache()
|
117 |
+
|
|
|
|
|
118 |
if upscale == "Yes":
|
119 |
+
image = sdxl(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale, output_type="latent").images
|
120 |
sdxl = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-refiner-1.0", use_safetensors=True, torch_dtype=torch.float16, variant="fp16") if torch.cuda.is_available() else DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-refiner-1.0")
|
121 |
sdxl.enable_xformers_memory_efficient_attention()
|
122 |
sdxl = sdxl.to(device)
|
|
|
124 |
refined = sdxl(Prompt, negative_prompt=negative_prompt, image=int_image, denoising_start=high_noise_frac).images[0]
|
125 |
torch.cuda.empty_cache()
|
126 |
return refined
|
127 |
+
else:
|
128 |
+
image = sdxl(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale).images[0]
|
129 |
+
torch.cuda.empty_cache()
|
130 |
+
|
131 |
return image
|
132 |
|
133 |
gr.Interface(fn=genie, inputs=[gr.Radio(['PhotoReal', 'Anime', 'Disney', 'StoryBook', 'SemiReal', 'Animagine XL 3.0', 'SDXL 1.0'], value='PhotoReal', label='Choose Model'),
|