Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -350,18 +350,27 @@ def genie (Model, Prompt, negative_prompt, height, width, scale, steps, seed, re
|
|
350 |
torch.cuda.empty_cache()
|
351 |
return image
|
352 |
|
353 |
-
if Model == '
|
354 |
torch.cuda.empty_cache()
|
355 |
from diffusers import StableCascadeCombinedPipeline
|
356 |
pipe = StableCascadeCombinedPipeline.from_pretrained("stabilityai/stable-cascade", variant="bf16", torch_dtype=torch.bfloat16)
|
357 |
pipe.enable_xformers_memory_efficient_attention()
|
358 |
pipe = pipe.to(device)
|
359 |
image = pipe(prompt=Prompt, negative_prompt=negative_prompt, num_inference_steps=10, prior_num_inference_steps=20, prior_guidance_scale=3.0, width=width, height=height).images[0]
|
360 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
361 |
|
362 |
return image
|
363 |
|
364 |
-
gr.Interface(fn=genie, inputs=[gr.Radio(['PhotoReal', 'Anime', 'Disney', 'StoryBook', 'SemiReal', 'Animagine XL 3.0', 'SDXL 1.0', 'FusionXL', '
|
365 |
gr.Textbox(label='What you want the AI to generate. 77 Token Limit.'),
|
366 |
gr.Textbox(label='What you Do Not want the AI to generate. 77 Token Limit'),
|
367 |
gr.Slider(512, 1280, 768, step=128, label='Height'),
|
|
|
350 |
torch.cuda.empty_cache()
|
351 |
return image
|
352 |
|
353 |
+
if Model == 'CascadeXL':
|
354 |
torch.cuda.empty_cache()
|
355 |
from diffusers import StableCascadeCombinedPipeline
|
356 |
pipe = StableCascadeCombinedPipeline.from_pretrained("stabilityai/stable-cascade", variant="bf16", torch_dtype=torch.bfloat16)
|
357 |
pipe.enable_xformers_memory_efficient_attention()
|
358 |
pipe = pipe.to(device)
|
359 |
image = pipe(prompt=Prompt, negative_prompt=negative_prompt, num_inference_steps=10, prior_num_inference_steps=20, prior_guidance_scale=3.0, width=width, height=height).images[0]
|
360 |
+
|
361 |
+
if upscale == 'Yes':
|
362 |
+
upscaler = DiffusionPipeline.from_pretrained("stabilityai/sd-x2-latent-upscaler", torch_dtype=torch.float16, use_safetensors=True)
|
363 |
+
upscaler.enable_xformers_memory_efficient_attention()
|
364 |
+
upscaler = upscaler.to(device)
|
365 |
+
torch.cuda.empty_cache()
|
366 |
+
upscaled = upscaler(prompt=Prompt, negative_prompt=negative_prompt, image=image, num_inference_steps=5, guidance_scale=0).images[0]
|
367 |
+
return upscaled
|
368 |
+
else:
|
369 |
+
return image
|
370 |
|
371 |
return image
|
372 |
|
373 |
+
gr.Interface(fn=genie, inputs=[gr.Radio(['PhotoReal', 'Anime', 'Disney', 'StoryBook', 'SemiReal', 'Animagine XL 3.0', 'SDXL 1.0', 'FusionXL', 'CascadeXL'], value='PhotoReal', label='Choose Model'),
|
374 |
gr.Textbox(label='What you want the AI to generate. 77 Token Limit.'),
|
375 |
gr.Textbox(label='What you Do Not want the AI to generate. 77 Token Limit'),
|
376 |
gr.Slider(512, 1280, 768, step=128, label='Height'),
|