Spaces:
Sleeping
Sleeping
Commit
•
57e4b5a
1
Parent(s):
3764fc1
Upload gradio_ootd.py
Browse files- run/gradio_ootd.py +27 -27
run/gradio_ootd.py
CHANGED
@@ -121,14 +121,14 @@ def process_dc(vton_img, garm_img, category, n_samples, n_steps, image_scale, se
|
|
121 |
block = gr.Blocks().queue()
|
122 |
with block:
|
123 |
with gr.Row():
|
124 |
-
gr.Markdown("#
|
125 |
with gr.Row():
|
126 |
-
gr.Markdown("##
|
127 |
with gr.Row():
|
128 |
-
gr.Markdown("
|
129 |
with gr.Row():
|
130 |
with gr.Column():
|
131 |
-
vton_img = gr.Image(label="
|
132 |
example = gr.Examples(
|
133 |
inputs=vton_img,
|
134 |
examples_per_page=14,
|
@@ -149,7 +149,7 @@ with block:
|
|
149 |
os.path.join(example_path, 'model/01861_00.jpg'),
|
150 |
])
|
151 |
with gr.Column():
|
152 |
-
garm_img = gr.Image(label="
|
153 |
example = gr.Examples(
|
154 |
inputs=garm_img,
|
155 |
examples_per_page=14,
|
@@ -170,28 +170,28 @@ with block:
|
|
170 |
os.path.join(example_path, 'garment/04825_00.jpg'),
|
171 |
])
|
172 |
with gr.Column():
|
173 |
-
result_gallery = gr.Gallery(label='
|
174 |
with gr.Column():
|
175 |
-
run_button = gr.Button(value="
|
176 |
-
n_samples = gr.Slider(label="
|
177 |
-
n_steps = gr.Slider(label="
|
178 |
# scale = gr.Slider(label="Scale", minimum=1.0, maximum=12.0, value=5.0, step=0.1)
|
179 |
-
image_scale = gr.Slider(label="
|
180 |
-
seed = gr.Slider(label="
|
181 |
|
182 |
ips = [vton_img, garm_img, n_samples, n_steps, image_scale, seed]
|
183 |
run_button.click(fn=process_hd, inputs=ips, outputs=[result_gallery])
|
184 |
|
185 |
|
186 |
with gr.Row():
|
187 |
-
gr.Markdown("##
|
188 |
with gr.Row():
|
189 |
-
gr.Markdown("
|
190 |
with gr.Row():
|
191 |
with gr.Column():
|
192 |
-
vton_img_dc = gr.Image(label="
|
193 |
example = gr.Examples(
|
194 |
-
label="
|
195 |
inputs=vton_img_dc,
|
196 |
examples_per_page=7,
|
197 |
examples=[
|
@@ -204,7 +204,7 @@ with block:
|
|
204 |
os.path.join(example_path, 'model/049205_0.jpg'),
|
205 |
])
|
206 |
example = gr.Examples(
|
207 |
-
label="
|
208 |
inputs=vton_img_dc,
|
209 |
examples_per_page=7,
|
210 |
examples=[
|
@@ -217,10 +217,10 @@ with block:
|
|
217 |
os.path.join(example_path, 'model/053700_0.jpg'),
|
218 |
])
|
219 |
with gr.Column():
|
220 |
-
garm_img_dc = gr.Image(label="
|
221 |
-
category_dc = gr.Dropdown(label="
|
222 |
example = gr.Examples(
|
223 |
-
label="
|
224 |
inputs=garm_img_dc,
|
225 |
examples_per_page=7,
|
226 |
examples=[
|
@@ -233,7 +233,7 @@ with block:
|
|
233 |
os.path.join(example_path, 'garment/050105_1.jpg'),
|
234 |
])
|
235 |
example = gr.Examples(
|
236 |
-
label="
|
237 |
inputs=garm_img_dc,
|
238 |
examples_per_page=7,
|
239 |
examples=[
|
@@ -246,7 +246,7 @@ with block:
|
|
246 |
os.path.join(example_path, 'garment/051412_1.jpg'),
|
247 |
])
|
248 |
example = gr.Examples(
|
249 |
-
label="
|
250 |
inputs=garm_img_dc,
|
251 |
examples_per_page=7,
|
252 |
examples=[
|
@@ -259,14 +259,14 @@ with block:
|
|
259 |
os.path.join(example_path, 'garment/052234_1.jpg'),
|
260 |
])
|
261 |
with gr.Column():
|
262 |
-
result_gallery_dc = gr.Gallery(label='
|
263 |
with gr.Column():
|
264 |
-
run_button_dc = gr.Button(value="
|
265 |
-
n_samples_dc = gr.Slider(label="
|
266 |
-
n_steps_dc = gr.Slider(label="
|
267 |
# scale_dc = gr.Slider(label="Scale", minimum=1.0, maximum=12.0, value=5.0, step=0.1)
|
268 |
-
image_scale_dc = gr.Slider(label="
|
269 |
-
seed_dc = gr.Slider(label="
|
270 |
|
271 |
ips_dc = [vton_img_dc, garm_img_dc, category_dc, n_samples_dc, n_steps_dc, image_scale_dc, seed_dc]
|
272 |
run_button_dc.click(fn=process_dc, inputs=ips_dc, outputs=[result_gallery_dc])
|
|
|
121 |
block = gr.Blocks().queue()
|
122 |
with block:
|
123 |
with gr.Row():
|
124 |
+
gr.Markdown("# 一键换装功能")
|
125 |
with gr.Row():
|
126 |
+
gr.Markdown("## 半身")
|
127 |
with gr.Row():
|
128 |
+
gr.Markdown("***支持上衣服装***")
|
129 |
with gr.Row():
|
130 |
with gr.Column():
|
131 |
+
vton_img = gr.Image(label="模特", sources='upload', type="filepath", height=384, value=model_hd)
|
132 |
example = gr.Examples(
|
133 |
inputs=vton_img,
|
134 |
examples_per_page=14,
|
|
|
149 |
os.path.join(example_path, 'model/01861_00.jpg'),
|
150 |
])
|
151 |
with gr.Column():
|
152 |
+
garm_img = gr.Image(label="服装", sources='upload', type="filepath", height=384, value=garment_hd)
|
153 |
example = gr.Examples(
|
154 |
inputs=garm_img,
|
155 |
examples_per_page=14,
|
|
|
170 |
os.path.join(example_path, 'garment/04825_00.jpg'),
|
171 |
])
|
172 |
with gr.Column():
|
173 |
+
result_gallery = gr.Gallery(label='输出', show_label=False, elem_id="gallery", preview=True, scale=1)
|
174 |
with gr.Column():
|
175 |
+
run_button = gr.Button(value="运行")
|
176 |
+
n_samples = gr.Slider(label="出图数", minimum=1, maximum=4, value=1, step=1)
|
177 |
+
n_steps = gr.Slider(label="步数", minimum=20, maximum=40, value=20, step=1)
|
178 |
# scale = gr.Slider(label="Scale", minimum=1.0, maximum=12.0, value=5.0, step=0.1)
|
179 |
+
image_scale = gr.Slider(label="引导相关性", minimum=1.0, maximum=5.0, value=2.0, step=0.1)
|
180 |
+
seed = gr.Slider(label="随机种子", minimum=-1, maximum=2147483647, step=1, value=-1)
|
181 |
|
182 |
ips = [vton_img, garm_img, n_samples, n_steps, image_scale, seed]
|
183 |
run_button.click(fn=process_hd, inputs=ips, outputs=[result_gallery])
|
184 |
|
185 |
|
186 |
with gr.Row():
|
187 |
+
gr.Markdown("## 全身")
|
188 |
with gr.Row():
|
189 |
+
gr.Markdown("***服装类别必须匹配!!!***")
|
190 |
with gr.Row():
|
191 |
with gr.Column():
|
192 |
+
vton_img_dc = gr.Image(label="模特", sources='upload', type="filepath", height=384, value=model_dc)
|
193 |
example = gr.Examples(
|
194 |
+
label="示例 (上半身/下半身)",
|
195 |
inputs=vton_img_dc,
|
196 |
examples_per_page=7,
|
197 |
examples=[
|
|
|
204 |
os.path.join(example_path, 'model/049205_0.jpg'),
|
205 |
])
|
206 |
example = gr.Examples(
|
207 |
+
label="示例 (连衣裙)",
|
208 |
inputs=vton_img_dc,
|
209 |
examples_per_page=7,
|
210 |
examples=[
|
|
|
217 |
os.path.join(example_path, 'model/053700_0.jpg'),
|
218 |
])
|
219 |
with gr.Column():
|
220 |
+
garm_img_dc = gr.Image(label="服装", sources='upload', type="filepath", height=384, value=garment_dc)
|
221 |
+
category_dc = gr.Dropdown(label="服装类别", choices=["Upper-body", "Lower-body", "Dress"], value="Upper-body")
|
222 |
example = gr.Examples(
|
223 |
+
label="示例 (上半身)",
|
224 |
inputs=garm_img_dc,
|
225 |
examples_per_page=7,
|
226 |
examples=[
|
|
|
233 |
os.path.join(example_path, 'garment/050105_1.jpg'),
|
234 |
])
|
235 |
example = gr.Examples(
|
236 |
+
label="示例 (下半身)",
|
237 |
inputs=garm_img_dc,
|
238 |
examples_per_page=7,
|
239 |
examples=[
|
|
|
246 |
os.path.join(example_path, 'garment/051412_1.jpg'),
|
247 |
])
|
248 |
example = gr.Examples(
|
249 |
+
label="示例 (连衣裙)",
|
250 |
inputs=garm_img_dc,
|
251 |
examples_per_page=7,
|
252 |
examples=[
|
|
|
259 |
os.path.join(example_path, 'garment/052234_1.jpg'),
|
260 |
])
|
261 |
with gr.Column():
|
262 |
+
result_gallery_dc = gr.Gallery(label='输出', show_label=False, elem_id="gallery", preview=True, scale=1)
|
263 |
with gr.Column():
|
264 |
+
run_button_dc = gr.Button(value="运行")
|
265 |
+
n_samples_dc = gr.Slider(label="出图数", minimum=1, maximum=4, value=1, step=1)
|
266 |
+
n_steps_dc = gr.Slider(label="步数", minimum=20, maximum=40, value=20, step=1)
|
267 |
# scale_dc = gr.Slider(label="Scale", minimum=1.0, maximum=12.0, value=5.0, step=0.1)
|
268 |
+
image_scale_dc = gr.Slider(label="引导相关性", minimum=1.0, maximum=5.0, value=2.0, step=0.1)
|
269 |
+
seed_dc = gr.Slider(label="随机种子", minimum=-1, maximum=2147483647, step=1, value=-1)
|
270 |
|
271 |
ips_dc = [vton_img_dc, garm_img_dc, category_dc, n_samples_dc, n_steps_dc, image_scale_dc, seed_dc]
|
272 |
run_button_dc.click(fn=process_dc, inputs=ips_dc, outputs=[result_gallery_dc])
|