Spaces:
Running
on
T4
Running
on
T4
Update app.py
Browse files
app.py
CHANGED
@@ -34,7 +34,24 @@ def genie (Model, Prompt, negative_prompt, height, width, scale, steps, seed):
|
|
34 |
image = animagine(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale).images[0]
|
35 |
torch.cuda.empty_cache()
|
36 |
return image
|
|
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
return image
|
39 |
|
40 |
gr.Interface(fn=genie, inputs=[gr.Radio(['PhotoReal', 'Animagine XL 4',], value='PhotoReal', label='Choose Model'),
|
@@ -47,6 +64,6 @@ gr.Interface(fn=genie, inputs=[gr.Radio(['PhotoReal', 'Animagine XL 4',], value=
|
|
47 |
gr.Slider(minimum=0, step=1, maximum=9999999999999999, randomize=True, label='Seed: 0 is Random'),
|
48 |
],
|
49 |
outputs=gr.Image(label='Generated Image'),
|
50 |
-
title="Manju Dream Booth V2.
|
51 |
description="<br><br><b/>Warning: This Demo is capable of producing NSFW content.",
|
52 |
article = "If You Enjoyed this Demo and would like to Donate, you can send any amount to any of these Wallets. <br><br>SHIB (BEP20): 0xbE8f2f3B71DFEB84E5F7E3aae1909d60658aB891 <br>PayPal: https://www.paypal.me/ManjushriBodhisattva <br>ETH: 0xbE8f2f3B71DFEB84E5F7E3aae1909d60658aB891 <br>DOGE: DL5qRkGCzB2ENBKfEhHarvKm1qas3wyHx7<br><br>Code Monkey: <a href=\"https://huggingface.co/Manjushri\">Manjushri</a>").launch(debug=True, max_threads=80)
|
|
|
34 |
image = animagine(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale).images[0]
|
35 |
torch.cuda.empty_cache()
|
36 |
return image
|
37 |
+
if Model == "FXL":
|
38 |
|
39 |
+
torch.cuda.empty_cache()
|
40 |
+
torch.cuda.max_memory_allocated(device=device)
|
41 |
+
pipe = DiffusionPipeline.from_pretrained("circulus/canvers-fusionXL-v1", torch_dtype=torch.float32)
|
42 |
+
pipe.enable_xformers_memory_efficient_attention()
|
43 |
+
pipe = pipe.to(device)
|
44 |
+
torch.cuda.empty_cache()
|
45 |
+
|
46 |
+
#torch.cuda.max_memory_allocated(device=device)
|
47 |
+
int_image = pipe(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale, output_type="latent").images
|
48 |
+
pipe = 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")
|
49 |
+
pipe.enable_xformers_memory_efficient_attention()
|
50 |
+
pipe = pipe.to(device)
|
51 |
+
torch.cuda.empty_cache()
|
52 |
+
image = pipe(Prompt, negative_prompt=negative_prompt, image=int_image, denoising_start=.99).images[0]
|
53 |
+
torch.cuda.empty_cache()
|
54 |
+
return image
|
55 |
return image
|
56 |
|
57 |
gr.Interface(fn=genie, inputs=[gr.Radio(['PhotoReal', 'Animagine XL 4',], value='PhotoReal', label='Choose Model'),
|
|
|
64 |
gr.Slider(minimum=0, step=1, maximum=9999999999999999, randomize=True, label='Seed: 0 is Random'),
|
65 |
],
|
66 |
outputs=gr.Image(label='Generated Image'),
|
67 |
+
title="Manju Dream Booth V2.6 - GPU",
|
68 |
description="<br><br><b/>Warning: This Demo is capable of producing NSFW content.",
|
69 |
article = "If You Enjoyed this Demo and would like to Donate, you can send any amount to any of these Wallets. <br><br>SHIB (BEP20): 0xbE8f2f3B71DFEB84E5F7E3aae1909d60658aB891 <br>PayPal: https://www.paypal.me/ManjushriBodhisattva <br>ETH: 0xbE8f2f3B71DFEB84E5F7E3aae1909d60658aB891 <br>DOGE: DL5qRkGCzB2ENBKfEhHarvKm1qas3wyHx7<br><br>Code Monkey: <a href=\"https://huggingface.co/Manjushri\">Manjushri</a>").launch(debug=True, max_threads=80)
|