Update app.py
Browse files
app.py
CHANGED
@@ -72,10 +72,25 @@ def genie (Model, Prompt, negative_prompt, height, width, scale, steps, seed, up
|
|
72 |
else:
|
73 |
image = story(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale).images[0]
|
74 |
torch.cuda.empty_cache()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
return image
|
77 |
|
78 |
-
gr.Interface(fn=genie, inputs=[gr.Radio(['Real', 'Anime', 'Disney', 'Story'], value='Real', label='Choose Canvers Model'),
|
79 |
gr.Textbox(label='What you want the AI to generate. 77 Token Limit.'),
|
80 |
gr.Textbox(label='What you Do Not want the AI to generate. 77 Token Limit'),
|
81 |
gr.Slider(512, 1024, 768, step=128, label='Height'),
|
@@ -86,6 +101,6 @@ gr.Interface(fn=genie, inputs=[gr.Radio(['Real', 'Anime', 'Disney', 'Story'], va
|
|
86 |
gr.Radio(["Yes", "No"], label='SDXL 1.0 Refiner: Use if the Image has too much Noise', value='No'),
|
87 |
gr.Slider(minimum=.9, maximum=.99, value=.95, step=.01, label='Refiner Denoise Start %')],
|
88 |
outputs=gr.Image(label='Generated Image'),
|
89 |
-
title="
|
90 |
description="<br><br><b/>Warning: This Demo is capable of producing NSFW content.",
|
91 |
article = "If You Enjoyed this Demo and would like to Donate, you can send to any of these Wallets. <br>BTC: bc1qzdm9j73mj8ucwwtsjx4x4ylyfvr6kp7svzjn84 <br>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)
|
|
|
72 |
else:
|
73 |
image = story(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale).images[0]
|
74 |
torch.cuda.empty_cache()
|
75 |
+
return image
|
76 |
+
|
77 |
+
if Model == "Semi":
|
78 |
+
semi = DiffusionPipeline.from_pretrained("circulus/canvers-semi-v3.8.1", torch_dtype=torch.float16, safety_checker=None) if torch.cuda.is_available() else DiffusionPipeline.from_pretrained("circulus/canvers-semi-v3.8.1")
|
79 |
+
semi = semi.to(device)
|
80 |
+
semi.enable_xformers_memory_efficient_attention()
|
81 |
+
torch.cuda.empty_cache()
|
82 |
+
if upscale == "Yes":
|
83 |
+
int_image = semi(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale).images
|
84 |
+
image = refiner(Prompt, negative_prompt=negative_prompt, image=int_image, denoising_start=high_noise_frac).images[0]
|
85 |
+
torch.cuda.empty_cache()
|
86 |
+
return image
|
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(['Real', 'Anime', 'Disney', 'Story', 'Semi'], value='Real', 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'),
|
|
|
101 |
gr.Radio(["Yes", "No"], label='SDXL 1.0 Refiner: Use if the Image has too much Noise', value='No'),
|
102 |
gr.Slider(minimum=.9, maximum=.99, value=.95, step=.01, label='Refiner Denoise Start %')],
|
103 |
outputs=gr.Image(label='Generated Image'),
|
104 |
+
title="Canvers Dream Booth V3.8.1 with SDXL 1.0 Refiner - GPU",
|
105 |
description="<br><br><b/>Warning: This Demo is capable of producing NSFW content.",
|
106 |
article = "If You Enjoyed this Demo and would like to Donate, you can send to any of these Wallets. <br>BTC: bc1qzdm9j73mj8ucwwtsjx4x4ylyfvr6kp7svzjn84 <br>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)
|