Spaces:
Running
on
Zero
Running
on
Zero
Commit
•
d80a29d
1
Parent(s):
b814200
Update app.py
Browse files
app.py
CHANGED
@@ -29,6 +29,7 @@ pipe = AutoPipelineForText2Image.from_pretrained(
|
|
29 |
torch_dtype=torch.float16,
|
30 |
use_auth_token=auth_token
|
31 |
)
|
|
|
32 |
|
33 |
pipe=pipe.to("cuda")
|
34 |
pipe.load_lora_weights(adapter_id)
|
@@ -106,28 +107,18 @@ def auto_prompt_correction(prompt_ui,neg_prompt_ui,disable_auto_prompt_correctio
|
|
106 |
return prompt,neg_prompt
|
107 |
|
108 |
def txt_to_img(prompt, neg_prompt, guidance, steps, width, height, generator):
|
|
|
|
|
109 |
result = pipe(
|
110 |
-
|
111 |
-
|
|
|
|
|
112 |
num_inference_steps = int(steps),
|
113 |
guidance_scale = guidance,
|
114 |
width = width,
|
115 |
height = height,
|
116 |
generator = generator)
|
117 |
-
|
118 |
-
if(0):
|
119 |
-
conditioning, pooled = compel([prompt, neg_prompt])
|
120 |
-
|
121 |
-
result = pipe(
|
122 |
-
prompt_embeds=conditioning[0:1],
|
123 |
-
pooled_prompt_embeds=pooled[0:1],
|
124 |
-
negative_prompt_embeds=conditioning[1:2],
|
125 |
-
negative_pooled_prompt_embeds=pooled[1:2],
|
126 |
-
num_inference_steps = int(steps),
|
127 |
-
guidance_scale = guidance,
|
128 |
-
width = width,
|
129 |
-
height = height,
|
130 |
-
generator = generator)
|
131 |
|
132 |
return result.images[0]
|
133 |
|
@@ -138,7 +129,7 @@ with gr.Blocks(css=css) as demo:
|
|
138 |
f"""
|
139 |
<div class="main-div">
|
140 |
<div>
|
141 |
-
<h1>Emi+LCM-LoRA Demo</h1>
|
142 |
<!--
|
143 |
<h2>
|
144 |
Other Demos:
|
|
|
29 |
torch_dtype=torch.float16,
|
30 |
use_auth_token=auth_token
|
31 |
)
|
32 |
+
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
|
33 |
|
34 |
pipe=pipe.to("cuda")
|
35 |
pipe.load_lora_weights(adapter_id)
|
|
|
107 |
return prompt,neg_prompt
|
108 |
|
109 |
def txt_to_img(prompt, neg_prompt, guidance, steps, width, height, generator):
|
110 |
+
conditioning, pooled = compel([prompt, neg_prompt])
|
111 |
+
|
112 |
result = pipe(
|
113 |
+
prompt_embeds=conditioning[0:1],
|
114 |
+
pooled_prompt_embeds=pooled[0:1],
|
115 |
+
negative_prompt_embeds=conditioning[1:2],
|
116 |
+
negative_pooled_prompt_embeds=pooled[1:2],
|
117 |
num_inference_steps = int(steps),
|
118 |
guidance_scale = guidance,
|
119 |
width = width,
|
120 |
height = height,
|
121 |
generator = generator)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
|
123 |
return result.images[0]
|
124 |
|
|
|
129 |
f"""
|
130 |
<div class="main-div">
|
131 |
<div>
|
132 |
+
<h1>Emi + LCM-LoRA Demo</h1>
|
133 |
<!--
|
134 |
<h2>
|
135 |
Other Demos:
|