Spaces:
Running
on
T4
Running
on
T4
Update app.py
Browse files
app.py
CHANGED
@@ -102,10 +102,25 @@ def genie (Model, Prompt, negative_prompt, height, width, scale, steps, seed, up
|
|
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
|
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'),
|
@@ -116,6 +131,6 @@ gr.Interface(fn=genie, inputs=[gr.Radio(['PhotoReal', 'Anime', 'Disney', 'StoryB
|
|
116 |
gr.Radio(["Yes", "No"], label='SDXL 1.0 Refiner: Use if the Image has too much Noise', value='No'),
|
117 |
gr.Slider(minimum=.9, maximum=.99, value=.95, step=.01, label='Refiner Denoise Start %')],
|
118 |
outputs=gr.Image(label='Generated Image'),
|
119 |
-
title="Manju Dream Booth
|
120 |
description="<br><br><b/>Warning: This Demo is capable of producing NSFW content.",
|
121 |
-
article = "If You Enjoyed this Demo and would like to Donate, you can send to any of these Wallets. <br>BTC: bc1qzdm9j73mj8ucwwtsjx4x4ylyfvr6kp7svzjn84 <br>BTC2: 3LWRoKYx6bCLnUrKEdnPo3FCSPQUSFDjFP <br>DOGE: DK6LRc4gfefdCTRk9xPD239N31jh9GjKez <br>SHIB (BEP20): 0xbE8f2f3B71DFEB84E5F7E3aae1909d60658aB891 <br>PayPal: https://www.paypal.me/ManjushriBodhisattva <br>ETH: 0xbE8f2f3B71DFEB84E5F7E3aae1909d60658aB891 <br>Code Monkey: <a href=\"https://huggingface.co/Manjushri\">Manjushri</a>").launch(debug=True, max_threads=80)
|
|
|
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 |
+
return image
|
106 |
+
|
107 |
+
if Model == "SDXL 1.0":
|
108 |
+
sdxl = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16, variant="fp16", use_safetensors=True)
|
109 |
+
sdxl = sdxl.to(device)
|
110 |
+
sdxl.enable_xformers_memory_efficient_attention()
|
111 |
+
torch.cuda.empty_cache()
|
112 |
+
if upscale == "Yes":
|
113 |
+
int_image = sdxl(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale).images
|
114 |
+
image = refiner(Prompt, negative_prompt=negative_prompt, image=int_image, denoising_start=high_noise_frac).images[0]
|
115 |
+
torch.cuda.empty_cache()
|
116 |
+
return image
|
117 |
+
else:
|
118 |
+
image = sdxl(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale).images[0]
|
119 |
+
torch.cuda.empty_cache()
|
120 |
+
|
121 |
return image
|
122 |
|
123 |
+
gr.Interface(fn=genie, inputs=[gr.Radio(['PhotoReal', 'Anime', 'Disney', 'StoryBook', 'SemiReal', 'Animagine XL 3.0', 'SDXL 1.0'], value='PhotoReal', label='Choose Model'),
|
124 |
gr.Textbox(label='What you want the AI to generate. 77 Token Limit.'),
|
125 |
gr.Textbox(label='What you Do Not want the AI to generate. 77 Token Limit'),
|
126 |
gr.Slider(512, 1024, 768, step=128, label='Height'),
|
|
|
131 |
gr.Radio(["Yes", "No"], label='SDXL 1.0 Refiner: Use if the Image has too much Noise', value='No'),
|
132 |
gr.Slider(minimum=.9, maximum=.99, value=.95, step=.01, label='Refiner Denoise Start %')],
|
133 |
outputs=gr.Image(label='Generated Image'),
|
134 |
+
title="Manju Dream Booth V1.5 with SDXL 1.0 Refiner - GPU",
|
135 |
description="<br><br><b/>Warning: This Demo is capable of producing NSFW content.",
|
136 |
+
article = "If You Enjoyed this Demo and would like to Donate, you can send any amount to any of these Wallets. <br><br>BTC: bc1qzdm9j73mj8ucwwtsjx4x4ylyfvr6kp7svzjn84 <br>BTC2: 3LWRoKYx6bCLnUrKEdnPo3FCSPQUSFDjFP <br>DOGE: DK6LRc4gfefdCTRk9xPD239N31jh9GjKez <br>SHIB (BEP20): 0xbE8f2f3B71DFEB84E5F7E3aae1909d60658aB891 <br>PayPal: https://www.paypal.me/ManjushriBodhisattva <br>ETH: 0xbE8f2f3B71DFEB84E5F7E3aae1909d60658aB891 <br>Code Monkey: <a href=\"https://huggingface.co/Manjushri\">Manjushri</a>").launch(debug=True, max_threads=80)
|