Spaces:
Running
Running
Update app.py
Browse filesUpgraded to SDXL 1.0
app.py
CHANGED
@@ -2,18 +2,14 @@ import gradio as gr
|
|
2 |
import torch
|
3 |
import modin.pandas as pd
|
4 |
from diffusers import DiffusionPipeline
|
5 |
-
from huggingface_hub import login
|
6 |
-
import os
|
7 |
-
|
8 |
-
login(token=os.environ.get('HF_KEY'))
|
9 |
|
10 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
11 |
|
12 |
-
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-0
|
13 |
pipe = pipe.to(device)
|
14 |
pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
|
15 |
|
16 |
-
refiner = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-refiner-0
|
17 |
refiner = refiner.to(device)
|
18 |
refiner.unet = torch.compile(refiner.unet, mode="reduce-overhead", fullgraph=True)
|
19 |
|
@@ -23,4 +19,4 @@ def genie (prompt, negative_prompt, scale, steps, seed):
|
|
23 |
image = refiner(prompt=prompt, negative_prompt=negative_prompt, image=int_image).images[0]
|
24 |
return image
|
25 |
|
26 |
-
gr.Interface(fn=genie, inputs=[gr.Textbox(label='What you want the AI to generate. 77 Token Limit.'), gr.Textbox(label='What you Do Not want the AI to generate.'), gr.Slider(1, 15, 10), gr.Slider(25, maximum=50, value=25, step=1), gr.Slider(minimum=1, step=1, maximum=999999999999999999, randomize=True)], outputs='image', title="Stable Diffusion XL 0
|
|
|
2 |
import torch
|
3 |
import modin.pandas as pd
|
4 |
from diffusers import DiffusionPipeline
|
|
|
|
|
|
|
|
|
5 |
|
6 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
7 |
|
8 |
+
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", use_safetensors=True)
|
9 |
pipe = pipe.to(device)
|
10 |
pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
|
11 |
|
12 |
+
refiner = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-refiner-1.0", use_safetensors=True)
|
13 |
refiner = refiner.to(device)
|
14 |
refiner.unet = torch.compile(refiner.unet, mode="reduce-overhead", fullgraph=True)
|
15 |
|
|
|
19 |
image = refiner(prompt=prompt, negative_prompt=negative_prompt, image=int_image).images[0]
|
20 |
return image
|
21 |
|
22 |
+
gr.Interface(fn=genie, inputs=[gr.Textbox(label='What you want the AI to generate. 77 Token Limit.'), gr.Textbox(label='What you Do Not want the AI to generate.'), gr.Slider(1, 15, 10), gr.Slider(25, maximum=50, value=25, step=1), gr.Slider(minimum=1, step=1, maximum=999999999999999999, randomize=True)], outputs='image', title="Stable Diffusion XL 1.0 CPU", description="SDXL 1.0 CPU. <b>WARNING:</b> Extremely Slow. 65s/Iteration. Expect 25-50mins an image for 25-50 iterations respectively.", article = "Code Monkey: <a href=\"https://huggingface.co/Manjushri\">Manjushri</a>").launch(debug=True, max_threads=80)
|