AkashKumarave commited on
Commit
c41faf2
·
verified ·
1 Parent(s): 7b6ec09

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -12
app.py CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
2
  import torch
3
  import modin.pandas as pd
4
  import numpy as np
5
- from diffusers import DiffusionPipeline
6
 
7
  device = "cuda" if torch.cuda.is_available() else "cpu"
8
 
@@ -13,20 +13,24 @@ if torch.cuda.is_available():
13
  pipe.enable_xformers_memory_efficient_attention()
14
  pipe = pipe.to(device)
15
  torch.cuda.empty_cache()
16
- else:
17
  pipe = DiffusionPipeline.from_pretrained("stabilityai/sdxl-turbo", use_safetensors=True)
18
  pipe = pipe.to(device)
19
-
20
- def genie (prompt, steps, seed):
21
  generator = np.random.seed(0) if seed == 0 else torch.manual_seed(seed)
22
  int_image = pipe(prompt=prompt, generator=generator, num_inference_steps=steps, guidance_scale=0.0).images[0]
23
  return int_image
24
-
25
- gr.Interface(fn=genie, inputs=[gr.Textbox(label='What you want the AI to generate. 77 Token Limit.'),
26
- gr.Slider(1, maximum=5, value=2, step=1, label='Number of Iterations'),
27
- gr.Slider(minimum=0, step=1, maximum=999999999999999999, randomize=True),
 
 
 
28
  ],
29
- outputs='image',
30
- title="Stable Diffusion Turbo CPU or GPU",
31
- description="SDXL Turbo CPU or GPU. Currently running on CPU. <br><br><b>WARNING: This model is capable of producing NSFW (Softcore) images.</b>",
32
- 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)
 
 
2
  import torch
3
  import modin.pandas as pd
4
  import numpy as np
5
+ from diffusers import DiffusionPipeline
6
 
7
  device = "cuda" if torch.cuda.is_available() else "cpu"
8
 
 
13
  pipe.enable_xformers_memory_efficient_attention()
14
  pipe = pipe.to(device)
15
  torch.cuda.empty_cache()
16
+ else:
17
  pipe = DiffusionPipeline.from_pretrained("stabilityai/sdxl-turbo", use_safetensors=True)
18
  pipe = pipe.to(device)
19
+
20
+ def genie(prompt, steps, seed):
21
  generator = np.random.seed(0) if seed == 0 else torch.manual_seed(seed)
22
  int_image = pipe(prompt=prompt, generator=generator, num_inference_steps=steps, guidance_scale=0.0).images[0]
23
  return int_image
24
+
25
+ gr.Interface(
26
+ fn=genie,
27
+ inputs=[
28
+ gr.Textbox(label="What you want the AI to generate. 77 Token Limit."),
29
+ gr.Slider(1, maximum=5, value=2, step=1, label="Number of Iterations"),
30
+ gr.Slider(minimum=0, step=1, maximum=999999999999999999, randomize=True),
31
  ],
32
+ outputs="image",
33
+ title="Stable Diffusion Turbo CPU or GPU",
34
+ description="SDXL Turbo CPU or GPU. Currently running on CPU. <br><br><b>WARNING: This model is capable of producing NSFW (Softcore) images.</b>",
35
+ article="Created by [Your Name]."
36
+ ).launch(debug=True, max_threads=80)