Spaces:
Running
on
T4
Running
on
T4
Krebzonide
commited on
Commit
·
70e3d12
1
Parent(s):
00f9af8
Update app.py
Browse files
app.py
CHANGED
@@ -14,43 +14,21 @@ lora_model_path = "Krebzonide/LoRA-CH-1" #mecjh - Corey H, traind on epiCRealism
|
|
14 |
#lora_model_path = "Krebzonide/LoRA-YX1" #uwspyx - Professor Xing, trained on Realistic_Vision
|
15 |
|
16 |
pipe = StableDiffusionPipeline.from_pretrained(model_base, torch_dtype=torch.float16, use_safetensors=True)
|
17 |
-
pipe.unet.load_attn_procs(lora_model_path)
|
18 |
-
#pipe.unet.load_attn_procs(lora_model_path, use_auth_token=True) #test accessing a private model----------------------
|
19 |
pipe.to("cuda")
|
20 |
|
21 |
css = """
|
22 |
.btn-green {
|
23 |
-
background-image: linear-gradient(to bottom right, #
|
24 |
border-color: #22c55e !important;
|
25 |
color: #166534 !important;
|
26 |
}
|
27 |
.btn-green:hover {
|
28 |
-
background-image: linear-gradient(to bottom right, #
|
29 |
}
|
30 |
-
.btn-red {
|
31 |
-
background: linear-gradient(to bottom right, #fda4af, #fb7185) !important;
|
32 |
-
border-color: #fb7185 !important;
|
33 |
-
color: #9f1239 !important;
|
34 |
-
}
|
35 |
-
.btn-red:hover {background: linear-gradient(to bottom right, #fda4af, #fda4af) !important;}
|
36 |
-
/*****/
|
37 |
-
.dark .btn-green {
|
38 |
-
background-image: linear-gradient(to bottom right, #047857, #065f46) !important;
|
39 |
-
border-color: #047857 !important;
|
40 |
-
color: #ffffff !important;
|
41 |
-
}
|
42 |
-
.dark .btn-green:hover {
|
43 |
-
background-image: linear-gradient(to bottom right, #047857, #047857) !important;
|
44 |
-
}
|
45 |
-
.dark .btn-red {
|
46 |
-
background: linear-gradient(to bottom right, #be123c, #9f1239) !important;
|
47 |
-
border-color: #be123c !important;
|
48 |
-
color: #ffffff !important;
|
49 |
-
}
|
50 |
-
.dark .btn-red:hover {background: linear-gradient(to bottom right, #be123c, #be123c) !important;}
|
51 |
"""
|
52 |
|
53 |
-
def generate(prompt, neg_prompt, samp_steps, guide_scale, lora_scale):
|
54 |
images = pipe(
|
55 |
prompt,
|
56 |
negative_prompt=neg_prompt,
|
@@ -66,10 +44,10 @@ with gr.Blocks(css=css) as demo:
|
|
66 |
with gr.Column():
|
67 |
prompt = gr.Textbox(label="Prompt")
|
68 |
negative_prompt = gr.Textbox(label="Negative Prompt", value="lowres, bad anatomy, bad hands, cropped, worst quality, disfigured, deformed, extra limbs, asian, filter, render")
|
69 |
-
submit_btn = gr.Button("Generate",
|
70 |
-
gallery = gr.Gallery(label="Generated images", height=
|
71 |
with gr.Row():
|
72 |
-
samp_steps = gr.Slider(1, 100, value=
|
73 |
guide_scale = gr.Slider(1, 10, value=6, step=0.5, label="Guidance scale")
|
74 |
lora_scale = gr.Slider(0, 1, value=0.5, step=0.01, label="LoRA power")
|
75 |
|
|
|
14 |
#lora_model_path = "Krebzonide/LoRA-YX1" #uwspyx - Professor Xing, trained on Realistic_Vision
|
15 |
|
16 |
pipe = StableDiffusionPipeline.from_pretrained(model_base, torch_dtype=torch.float16, use_safetensors=True)
|
17 |
+
pipe.unet.load_attn_procs(lora_model_path)
|
|
|
18 |
pipe.to("cuda")
|
19 |
|
20 |
css = """
|
21 |
.btn-green {
|
22 |
+
background-image: linear-gradient(to bottom right, #6dd178, #00a613) !important;
|
23 |
border-color: #22c55e !important;
|
24 |
color: #166534 !important;
|
25 |
}
|
26 |
.btn-green:hover {
|
27 |
+
background-image: linear-gradient(to bottom right, #6dd178, #6dd178) !important;
|
28 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
"""
|
30 |
|
31 |
+
def generate(prompt, neg_prompt, samp_steps, guide_scale, lora_scale, progress=gr.Progress(track_tqdm=True)):
|
32 |
images = pipe(
|
33 |
prompt,
|
34 |
negative_prompt=neg_prompt,
|
|
|
44 |
with gr.Column():
|
45 |
prompt = gr.Textbox(label="Prompt")
|
46 |
negative_prompt = gr.Textbox(label="Negative Prompt", value="lowres, bad anatomy, bad hands, cropped, worst quality, disfigured, deformed, extra limbs, asian, filter, render")
|
47 |
+
submit_btn = gr.Button("Generate", elem_classes="btn-green")
|
48 |
+
gallery = gr.Gallery(label="Generated images", height=700)
|
49 |
with gr.Row():
|
50 |
+
samp_steps = gr.Slider(1, 100, value=25, step=1, label="Sampling steps")
|
51 |
guide_scale = gr.Slider(1, 10, value=6, step=0.5, label="Guidance scale")
|
52 |
lora_scale = gr.Slider(0, 1, value=0.5, step=0.01, label="LoRA power")
|
53 |
|