Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -350,9 +350,6 @@ def genie (Model, Prompt, negative_prompt, height, width, scale, steps, seed, re
|
|
350 |
torch.cuda.empty_cache()
|
351 |
return image
|
352 |
if Model == 'SDXL-Turbo':
|
353 |
-
#from diffusers import AutoPipelineForText2Image
|
354 |
-
#pipe = AutoPipelineForText2Image.from_pretrained("stabilityai/sdxl-turbo", torch_dtype=torch.float16, variant="fp16")
|
355 |
-
#pipe.to("cuda")
|
356 |
torch.cuda.empty_cache()
|
357 |
pipe = DiffusionPipeline.from_pretrained("stabilityai/sdxl-turbo", torch_dtype=torch.float16, variant="fp16")
|
358 |
pipe.enable_xformers_memory_efficient_attention()
|
@@ -365,7 +362,16 @@ def genie (Model, Prompt, negative_prompt, height, width, scale, steps, seed, re
|
|
365 |
torch.cuda.empty_cache()
|
366 |
refined = refiner(Prompt, negative_prompt=negative_prompt, image=image, denoising_start=high_noise_frac).images[0]
|
367 |
torch.cuda.empty_cache()
|
368 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
369 |
return image
|
370 |
|
371 |
gr.Interface(fn=genie, inputs=[gr.Radio(['PhotoReal', 'Anime', 'Disney', 'StoryBook', 'SemiReal', 'Animagine XL 3.0', 'SDXL 1.0', 'FusionXL', 'SDXL-Turbo'], value='PhotoReal', label='Choose Model'),
|
|
|
350 |
torch.cuda.empty_cache()
|
351 |
return image
|
352 |
if Model == 'SDXL-Turbo':
|
|
|
|
|
|
|
353 |
torch.cuda.empty_cache()
|
354 |
pipe = DiffusionPipeline.from_pretrained("stabilityai/sdxl-turbo", torch_dtype=torch.float16, variant="fp16")
|
355 |
pipe.enable_xformers_memory_efficient_attention()
|
|
|
362 |
torch.cuda.empty_cache()
|
363 |
refined = refiner(Prompt, negative_prompt=negative_prompt, image=image, denoising_start=high_noise_frac).images[0]
|
364 |
torch.cuda.empty_cache()
|
365 |
+
if upscale == 'Yes':
|
366 |
+
upscaler = DiffusionPipeline.from_pretrained("stabilityai/sd-x2-latent-upscaler", torch_dtype=torch.float16, use_safetensors=True)
|
367 |
+
upscaler.enable_xformers_memory_efficient_attention()
|
368 |
+
upscaler = upscaler.to(device)
|
369 |
+
torch.cuda.empty_cache()
|
370 |
+
upscaled = upscaler(prompt=Prompt, negative_prompt=negative_prompt, image=refined, num_inference_steps=5, guidance_scale=0).images[0]
|
371 |
+
torch.cuda.empty_cache()
|
372 |
+
return upscaled
|
373 |
+
else:
|
374 |
+
return refined
|
375 |
return image
|
376 |
|
377 |
gr.Interface(fn=genie, inputs=[gr.Radio(['PhotoReal', 'Anime', 'Disney', 'StoryBook', 'SemiReal', 'Animagine XL 3.0', 'SDXL 1.0', 'FusionXL', 'SDXL-Turbo'], value='PhotoReal', label='Choose Model'),
|