Update app.py
Browse files
app.py
CHANGED
|
@@ -87,10 +87,25 @@ def genie (Model, Prompt, negative_prompt, height, width, scale, steps, seed, up
|
|
| 87 |
else:
|
| 88 |
image = semi(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale).images[0]
|
| 89 |
torch.cuda.empty_cache()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
|
| 91 |
return image
|
| 92 |
|
| 93 |
-
gr.Interface(fn=genie, inputs=[gr.Radio(['PhotoReal', 'Anime', 'Disney', 'StoryBook', 'SemiReal'], value='PhotoReal', label='Choose Canvers Model'),
|
| 94 |
gr.Textbox(label='What you want the AI to generate. 77 Token Limit.'),
|
| 95 |
gr.Textbox(label='What you Do Not want the AI to generate. 77 Token Limit'),
|
| 96 |
gr.Slider(512, 1024, 768, step=128, label='Height'),
|
|
|
|
| 87 |
else:
|
| 88 |
image = semi(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale).images[0]
|
| 89 |
torch.cuda.empty_cache()
|
| 90 |
+
return image
|
| 91 |
+
|
| 92 |
+
if Model == "Animagine XL 3.0":
|
| 93 |
+
animagine = DiffusionPipeline.from_pretrained("cagliostrolab/animagine-xl-3.0", torch_dtype=torch.float16, safety_checker=None) if torch.cuda.is_available() else DiffusionPipeline.from_pretrained("cagliostrolab/animagine-xl-3.0")
|
| 94 |
+
animagine = animagine.to(device)
|
| 95 |
+
animagine.enable_xformers_memory_efficient_attention()
|
| 96 |
+
torch.cuda.empty_cache()
|
| 97 |
+
if upscale == "Yes":
|
| 98 |
+
int_image = animagine(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale).images
|
| 99 |
+
image = refiner(Prompt, negative_prompt=negative_prompt, image=int_image, denoising_start=high_noise_frac).images[0]
|
| 100 |
+
torch.cuda.empty_cache()
|
| 101 |
+
return image
|
| 102 |
+
else:
|
| 103 |
+
image = animagine(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale).images[0]
|
| 104 |
+
torch.cuda.empty_cache()
|
| 105 |
|
| 106 |
return image
|
| 107 |
|
| 108 |
+
gr.Interface(fn=genie, inputs=[gr.Radio(['PhotoReal', 'Anime', 'Disney', 'StoryBook', 'SemiReal', 'Animagine XL 3.0'], value='PhotoReal', label='Choose Canvers Model'),
|
| 109 |
gr.Textbox(label='What you want the AI to generate. 77 Token Limit.'),
|
| 110 |
gr.Textbox(label='What you Do Not want the AI to generate. 77 Token Limit'),
|
| 111 |
gr.Slider(512, 1024, 768, step=128, label='Height'),
|