Spaces:
Runtime error
Runtime error
Rename app_canny.py to app_edge.py
Browse files- app_canny.py → app_edge.py +21 -6
app_canny.py → app_edge.py
RENAMED
|
@@ -18,10 +18,10 @@ examples = [
|
|
| 18 |
"condition/example/t2i/multigen/girl.jpg",
|
| 19 |
"An anime style girl with blue hair", "(512, 512)"
|
| 20 |
],
|
| 21 |
-
[
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
],
|
| 25 |
]
|
| 26 |
|
| 27 |
|
|
@@ -33,6 +33,18 @@ def create_demo(process):
|
|
| 33 |
prompt = gr.Textbox(label="Prompt")
|
| 34 |
run_button = gr.Button("Run")
|
| 35 |
with gr.Accordion("Advanced options", open=False):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
canny_low_threshold = gr.Slider(
|
| 37 |
label="Canny low threshold",
|
| 38 |
minimum=0,
|
|
@@ -50,6 +62,7 @@ def create_demo(process):
|
|
| 50 |
maximum=30.0,
|
| 51 |
value=2,
|
| 52 |
step=0.1)
|
|
|
|
| 53 |
relolution = gr.Slider(label="(H, W)",
|
| 54 |
minimum=384,
|
| 55 |
maximum=768,
|
|
@@ -101,6 +114,8 @@ def create_demo(process):
|
|
| 101 |
seed,
|
| 102 |
canny_low_threshold,
|
| 103 |
canny_high_threshold,
|
|
|
|
|
|
|
| 104 |
]
|
| 105 |
# prompt.submit(
|
| 106 |
# fn=randomize_seed_fn,
|
|
@@ -124,7 +139,7 @@ def create_demo(process):
|
|
| 124 |
fn=process,
|
| 125 |
inputs=inputs,
|
| 126 |
outputs=result,
|
| 127 |
-
api_name="
|
| 128 |
)
|
| 129 |
return demo
|
| 130 |
|
|
@@ -132,5 +147,5 @@ def create_demo(process):
|
|
| 132 |
if __name__ == "__main__":
|
| 133 |
from model import Model
|
| 134 |
model = Model()
|
| 135 |
-
demo = create_demo(model.
|
| 136 |
demo.queue().launch(share=False, server_name="0.0.0.0")
|
|
|
|
| 18 |
"condition/example/t2i/multigen/girl.jpg",
|
| 19 |
"An anime style girl with blue hair", "(512, 512)"
|
| 20 |
],
|
| 21 |
+
# [
|
| 22 |
+
# "condition/example/t2i/multi_resolution/bird.jpg", "colorful bird",
|
| 23 |
+
# "(921, 564)"
|
| 24 |
+
# ],
|
| 25 |
]
|
| 26 |
|
| 27 |
|
|
|
|
| 33 |
prompt = gr.Textbox(label="Prompt")
|
| 34 |
run_button = gr.Button("Run")
|
| 35 |
with gr.Accordion("Advanced options", open=False):
|
| 36 |
+
preprocessor_name = gr.Radio(
|
| 37 |
+
label="Preprocessor",
|
| 38 |
+
choices=[
|
| 39 |
+
"Canny",
|
| 40 |
+
"Hed",
|
| 41 |
+
"Lineart",
|
| 42 |
+
"No preprocess",
|
| 43 |
+
],
|
| 44 |
+
type="value",
|
| 45 |
+
value="Canny",
|
| 46 |
+
info='Edge type.',
|
| 47 |
+
)
|
| 48 |
canny_low_threshold = gr.Slider(
|
| 49 |
label="Canny low threshold",
|
| 50 |
minimum=0,
|
|
|
|
| 62 |
maximum=30.0,
|
| 63 |
value=2,
|
| 64 |
step=0.1)
|
| 65 |
+
control_strength = gr.Slider(minimum=0., maximum=1.0, step=0.1, value=1.0, label="control_strength")
|
| 66 |
relolution = gr.Slider(label="(H, W)",
|
| 67 |
minimum=384,
|
| 68 |
maximum=768,
|
|
|
|
| 114 |
seed,
|
| 115 |
canny_low_threshold,
|
| 116 |
canny_high_threshold,
|
| 117 |
+
control_strength,
|
| 118 |
+
preprocessor_name,
|
| 119 |
]
|
| 120 |
# prompt.submit(
|
| 121 |
# fn=randomize_seed_fn,
|
|
|
|
| 139 |
fn=process,
|
| 140 |
inputs=inputs,
|
| 141 |
outputs=result,
|
| 142 |
+
api_name="edge",
|
| 143 |
)
|
| 144 |
return demo
|
| 145 |
|
|
|
|
| 147 |
if __name__ == "__main__":
|
| 148 |
from model import Model
|
| 149 |
model = Model()
|
| 150 |
+
demo = create_demo(model.process_edge)
|
| 151 |
demo.queue().launch(share=False, server_name="0.0.0.0")
|