Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
|
2 |
import numpy as np
|
3 |
import torch
|
4 |
from diffusers import StableDiffusionPipeline
|
@@ -195,21 +195,6 @@ with gr.Blocks(css=css) as demo:
|
|
195 |
value=30,
|
196 |
)
|
197 |
|
198 |
-
with gr.Row(): # Добавляем чекбокс для ControlNet
|
199 |
-
use_control_net = gr.Checkbox(
|
200 |
-
label="Use ControlNet",
|
201 |
-
value=False,
|
202 |
-
)
|
203 |
-
|
204 |
-
with gr.Row(visible=False, id="control_net_row"): # Скрываем элемент по умолчанию
|
205 |
-
control_net_weight = gr.Slider(
|
206 |
-
label="ControlNet Weight",
|
207 |
-
minimum=0.0,
|
208 |
-
maximum=1.0,
|
209 |
-
step=0.01,
|
210 |
-
value=1.0,
|
211 |
-
)
|
212 |
-
|
213 |
with gr.Accordion("Advanced Settings", open=False):
|
214 |
with gr.Row():
|
215 |
width = gr.Slider(
|
@@ -229,6 +214,21 @@ with gr.Blocks(css=css) as demo:
|
|
229 |
value=512,
|
230 |
)
|
231 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
232 |
gr.Examples(examples=examples, inputs=[prompt])
|
233 |
gr.Examples(examples=examples_negative, inputs=[negative_prompt])
|
234 |
|
@@ -239,7 +239,7 @@ with gr.Blocks(css=css) as demo:
|
|
239 |
return {"visible": use_control_net}
|
240 |
|
241 |
use_control_net.change(fn=toggle_control_net_visibility, inputs=[use_control_net], outputs=["control_net_row"])
|
242 |
-
|
243 |
gr.on(
|
244 |
triggers=[run_button.click, prompt.submit],
|
245 |
fn=infer,
|
@@ -261,4 +261,5 @@ with gr.Blocks(css=css) as demo:
|
|
261 |
|
262 |
if __name__ == "__main__":
|
263 |
demo.launch()
|
|
|
264 |
|
|
|
1 |
+
mport gradio as gr
|
2 |
import numpy as np
|
3 |
import torch
|
4 |
from diffusers import StableDiffusionPipeline
|
|
|
195 |
value=30,
|
196 |
)
|
197 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
with gr.Accordion("Advanced Settings", open=False):
|
199 |
with gr.Row():
|
200 |
width = gr.Slider(
|
|
|
214 |
value=512,
|
215 |
)
|
216 |
|
217 |
+
with gr.Row(): # Добавляем чекбокс для ControlNet
|
218 |
+
use_control_net = gr.Checkbox(
|
219 |
+
label="Use ControlNet",
|
220 |
+
value=False,
|
221 |
+
)
|
222 |
+
|
223 |
+
with gr.Row(visible=False, id="control_net_row"): # Скрываем элемент по умолчанию
|
224 |
+
control_net_weight = gr.Slider(
|
225 |
+
label="ControlNet Weight",
|
226 |
+
minimum=0.0,
|
227 |
+
maximum=1.0,
|
228 |
+
step=0.01,
|
229 |
+
value=1.0,
|
230 |
+
)
|
231 |
+
|
232 |
gr.Examples(examples=examples, inputs=[prompt])
|
233 |
gr.Examples(examples=examples_negative, inputs=[negative_prompt])
|
234 |
|
|
|
239 |
return {"visible": use_control_net}
|
240 |
|
241 |
use_control_net.change(fn=toggle_control_net_visibility, inputs=[use_control_net], outputs=["control_net_row"])
|
242 |
+
|
243 |
gr.on(
|
244 |
triggers=[run_button.click, prompt.submit],
|
245 |
fn=infer,
|
|
|
261 |
|
262 |
if __name__ == "__main__":
|
263 |
demo.launch()
|
264 |
+
|
265 |
|