Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -22,7 +22,7 @@ DEFAULT_NEGATIVE_PROMPT = (
|
|
22 |
def run(*args):
|
23 |
id_image = args[0]
|
24 |
supp_images = args[1]
|
25 |
-
prompt, neg_prompt,
|
26 |
|
27 |
pipeline.debug_img_list = []
|
28 |
if mode == 'fidelity':
|
@@ -97,6 +97,7 @@ with gr.Blocks(title="ToonMagev2", js = js_func, theme = theme) as SAK:
|
|
97 |
with gr.Row():
|
98 |
with gr.Column():
|
99 |
with gr.Row():
|
|
|
100 |
face_image = gr.Image(label="ID image (main)", sources="upload", type="numpy", height=256)
|
101 |
supp_image1 = gr.Image(
|
102 |
label="Additional ID image (auxiliary)", sources="upload", type="numpy", height=256
|
@@ -108,8 +109,20 @@ with gr.Blocks(title="ToonMagev2", js = js_func, theme = theme) as SAK:
|
|
108 |
# label="Additional ID image (auxiliary)", sources="upload", type="numpy", height=256
|
109 |
# )
|
110 |
prompt = gr.Textbox(label="Prompt", value='portrait,cinematic,wolf ears,white hair')
|
111 |
-
|
112 |
neg_prompt = gr.Textbox(label="Negative Prompt", value=DEFAULT_NEGATIVE_PROMPT)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
scale = gr.Slider(
|
114 |
label="CFG, recommend value range [1, 1.5], 1 will be faster ",
|
115 |
value=1.2,
|
@@ -117,21 +130,9 @@ with gr.Blocks(title="ToonMagev2", js = js_func, theme = theme) as SAK:
|
|
117 |
maximum=1.5,
|
118 |
step=0.1,
|
119 |
)
|
120 |
-
n_samples = gr.Slider(label="Num samples", value=4, minimum=1, maximum=4, step=1)
|
121 |
-
seed = gr.Slider(
|
122 |
-
label="Seed", value=42, minimum=np.iinfo(np.uint32).min, maximum=np.iinfo(np.uint32).max, step=1
|
123 |
-
)
|
124 |
-
steps = gr.Slider(label="Steps", value=4, minimum=1, maximum=8, step=1)
|
125 |
with gr.Row():
|
126 |
H = gr.Slider(label="Height", value=1024, minimum=512, maximum=1280, step=64)
|
127 |
W = gr.Slider(label="Width", value=768, minimum=512, maximum=1280, step=64)
|
128 |
-
with gr.Row():
|
129 |
-
id_scale = gr.Slider(label="ID scale", minimum=0, maximum=5, step=0.05, value=0.8, interactive=True)
|
130 |
-
mode = gr.Dropdown(label="mode", choices=['fidelity', 'extremely style'], value='fidelity')
|
131 |
-
id_mix = gr.Checkbox(
|
132 |
-
label="ID Mix (if you want to mix two ID image, please turn this on, otherwise, turn this off)",
|
133 |
-
value=False,
|
134 |
-
)
|
135 |
|
136 |
gr.Markdown("## Examples")
|
137 |
example_inps = [
|
@@ -146,7 +147,7 @@ with gr.Blocks(title="ToonMagev2", js = js_func, theme = theme) as SAK:
|
|
146 |
example_inps = [
|
147 |
[
|
148 |
'portrait, impressionist painting, loose brushwork, vibrant color, light and shadow play',
|
149 |
-
'sample_img/
|
150 |
'fidelity',
|
151 |
]
|
152 |
]
|
@@ -155,7 +156,7 @@ with gr.Blocks(title="ToonMagev2", js = js_func, theme = theme) as SAK:
|
|
155 |
example_inps = [
|
156 |
[
|
157 |
'portrait, flat papercut style, silhouette, clean cuts, paper, sharp edges, minimalist,color block,man',
|
158 |
-
'sample_img/
|
159 |
'fidelity',
|
160 |
]
|
161 |
]
|
@@ -202,10 +203,10 @@ with gr.Blocks(title="ToonMagev2", js = js_func, theme = theme) as SAK:
|
|
202 |
# supp_image3,
|
203 |
prompt,
|
204 |
neg_prompt,
|
205 |
-
scale,
|
206 |
-
n_samples,
|
207 |
-
seed,
|
208 |
steps,
|
|
|
|
|
|
|
209 |
H,
|
210 |
W,
|
211 |
id_scale,
|
|
|
22 |
def run(*args):
|
23 |
id_image = args[0]
|
24 |
supp_images = args[1]
|
25 |
+
prompt, neg_prompt, id_scale, mode, id_mix, steps, seed, n_samples, scale, H, W = args[2:]
|
26 |
|
27 |
pipeline.debug_img_list = []
|
28 |
if mode == 'fidelity':
|
|
|
97 |
with gr.Row():
|
98 |
with gr.Column():
|
99 |
with gr.Row():
|
100 |
+
submit = gr.Button("Generate")
|
101 |
face_image = gr.Image(label="ID image (main)", sources="upload", type="numpy", height=256)
|
102 |
supp_image1 = gr.Image(
|
103 |
label="Additional ID image (auxiliary)", sources="upload", type="numpy", height=256
|
|
|
109 |
# label="Additional ID image (auxiliary)", sources="upload", type="numpy", height=256
|
110 |
# )
|
111 |
prompt = gr.Textbox(label="Prompt", value='portrait,cinematic,wolf ears,white hair')
|
112 |
+
|
113 |
neg_prompt = gr.Textbox(label="Negative Prompt", value=DEFAULT_NEGATIVE_PROMPT)
|
114 |
+
with gr.Row():
|
115 |
+
id_scale = gr.Slider(label="ID scale", minimum=0, maximum=5, step=0.05, value=0.8, interactive=True)
|
116 |
+
mode = gr.Dropdown(label="mode", choices=['fidelity', 'extremely style'], value='fidelity')
|
117 |
+
id_mix = gr.Checkbox(
|
118 |
+
label="ID Mix (if you want to mix two ID image, please turn this on, otherwise, turn this off)",
|
119 |
+
value=False,
|
120 |
+
)
|
121 |
+
steps = gr.Slider(label="Steps", value=4, minimum=1, maximum=8, step=1)
|
122 |
+
seed = gr.Slider(
|
123 |
+
label="Seed", value=42, minimum=np.iinfo(np.uint32).min, maximum=np.iinfo(np.uint32).max, step=1
|
124 |
+
)
|
125 |
+
n_samples = gr.Slider(label="Num samples", value=2, minimum=1, maximum=4, step=1)
|
126 |
scale = gr.Slider(
|
127 |
label="CFG, recommend value range [1, 1.5], 1 will be faster ",
|
128 |
value=1.2,
|
|
|
130 |
maximum=1.5,
|
131 |
step=0.1,
|
132 |
)
|
|
|
|
|
|
|
|
|
|
|
133 |
with gr.Row():
|
134 |
H = gr.Slider(label="Height", value=1024, minimum=512, maximum=1280, step=64)
|
135 |
W = gr.Slider(label="Width", value=768, minimum=512, maximum=1280, step=64)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
|
137 |
gr.Markdown("## Examples")
|
138 |
example_inps = [
|
|
|
147 |
example_inps = [
|
148 |
[
|
149 |
'portrait, impressionist painting, loose brushwork, vibrant color, light and shadow play',
|
150 |
+
'sample_img/sample_img_test24.jpg',
|
151 |
'fidelity',
|
152 |
]
|
153 |
]
|
|
|
156 |
example_inps = [
|
157 |
[
|
158 |
'portrait, flat papercut style, silhouette, clean cuts, paper, sharp edges, minimalist,color block,man',
|
159 |
+
'sample_img/sample_img_test1.jpg',
|
160 |
'fidelity',
|
161 |
]
|
162 |
]
|
|
|
203 |
# supp_image3,
|
204 |
prompt,
|
205 |
neg_prompt,
|
|
|
|
|
|
|
206 |
steps,
|
207 |
+
seed,
|
208 |
+
n_samples,
|
209 |
+
scale,
|
210 |
H,
|
211 |
W,
|
212 |
id_scale,
|