Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -185,110 +185,23 @@ if __name__ == "__main__":
|
|
185 |
with gr.Blocks() as demo:
|
186 |
|
187 |
with gr.Column():
|
188 |
-
# gr.HTML(title)
|
189 |
|
190 |
with gr.Row():
|
191 |
with gr.Column():
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
|
|
200 |
run_button = gr.Button("Generate")
|
201 |
|
202 |
-
# with gr.Row():
|
203 |
-
# with gr.Column(scale=2):
|
204 |
-
# prompt_input = gr.Textbox(label="Prompt (Optional)")
|
205 |
-
# with gr.Column(scale=1):
|
206 |
-
# run_button = gr.Button("Generate")
|
207 |
-
|
208 |
-
# with gr.Row():
|
209 |
-
# target_ratio = gr.Radio(
|
210 |
-
# label="Expected Ratio",
|
211 |
-
# choices=["9:16", "16:9", "1:1", "Custom"],
|
212 |
-
# value="9:16",
|
213 |
-
# scale=2
|
214 |
-
# )
|
215 |
-
|
216 |
-
# alignment_dropdown = gr.Dropdown(
|
217 |
-
# choices=["Middle", "Left", "Right", "Top", "Bottom"],
|
218 |
-
# value="Middle",
|
219 |
-
# label="Alignment"
|
220 |
-
# )
|
221 |
-
|
222 |
-
# with gr.Accordion(label="Advanced settings", open=False) as settings_panel:
|
223 |
-
# with gr.Column():
|
224 |
-
# with gr.Row():
|
225 |
-
# width_slider = gr.Slider(
|
226 |
-
# label="Target Width",
|
227 |
-
# minimum=720,
|
228 |
-
# maximum=1536,
|
229 |
-
# step=8,
|
230 |
-
# value=720, # Set a default value
|
231 |
-
# )
|
232 |
-
# height_slider = gr.Slider(
|
233 |
-
# label="Target Height",
|
234 |
-
# minimum=720,
|
235 |
-
# maximum=1536,
|
236 |
-
# step=8,
|
237 |
-
# value=1280, # Set a default value
|
238 |
-
# )
|
239 |
-
|
240 |
-
# num_inference_steps = gr.Slider(label="Steps", minimum=4, maximum=12, step=1, value=8)
|
241 |
-
# with gr.Group():
|
242 |
-
# overlap_percentage = gr.Slider(
|
243 |
-
# label="Mask overlap (%)",
|
244 |
-
# minimum=1,
|
245 |
-
# maximum=50,
|
246 |
-
# value=10,
|
247 |
-
# step=1
|
248 |
-
# )
|
249 |
-
# with gr.Row():
|
250 |
-
# overlap_top = gr.Checkbox(label="Overlap Top", value=True)
|
251 |
-
# overlap_right = gr.Checkbox(label="Overlap Right", value=True)
|
252 |
-
# with gr.Row():
|
253 |
-
# overlap_left = gr.Checkbox(label="Overlap Left", value=True)
|
254 |
-
# overlap_bottom = gr.Checkbox(label="Overlap Bottom", value=True)
|
255 |
-
# with gr.Row():
|
256 |
-
# resize_option = gr.Radio(
|
257 |
-
# label="Resize input image",
|
258 |
-
# choices=["Full", "50%", "33%", "25%", "Custom"],
|
259 |
-
# value="Full"
|
260 |
-
# )
|
261 |
-
# custom_resize_percentage = gr.Slider(
|
262 |
-
# label="Custom resize (%)",
|
263 |
-
# minimum=1,
|
264 |
-
# maximum=100,
|
265 |
-
# step=1,
|
266 |
-
# value=50,
|
267 |
-
# visible=False
|
268 |
-
# )
|
269 |
-
|
270 |
-
# with gr.Column():
|
271 |
-
# preview_button = gr.Button("Preview alignment and mask")
|
272 |
-
|
273 |
-
|
274 |
-
# gr.Examples(
|
275 |
-
# examples=[
|
276 |
-
# ["./examples/example_1.webp", 1280, 720, "Middle"],
|
277 |
-
# ["./examples/example_2.jpg", 1440, 810, "Left"],
|
278 |
-
# ["./examples/example_3.jpg", 1024, 1024, "Top"],
|
279 |
-
# ["./examples/example_3.jpg", 1024, 1024, "Bottom"],
|
280 |
-
# ],
|
281 |
-
# inputs=[input_image, width_slider, height_slider, alignment_dropdown],
|
282 |
-
# )
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
with gr.Column():
|
287 |
result = gr.Image(type='pil', label='Image Output')
|
288 |
-
|
289 |
-
|
290 |
-
# history_gallery = gr.Gallery(label="History", columns=6, object_fit="contain", interactive=False)
|
291 |
-
# preview_image = gr.Image(label="Preview")
|
292 |
run_button.click(
|
293 |
fn=infer_headswap,
|
294 |
inputs=[input_source, input_target],
|
|
|
185 |
with gr.Blocks() as demo:
|
186 |
|
187 |
with gr.Column():
|
|
|
188 |
|
189 |
with gr.Row():
|
190 |
with gr.Column():
|
191 |
+
with gr.Row(equal_height=True):
|
192 |
+
input_source = gr.Image(
|
193 |
+
type="pil",
|
194 |
+
label="Input Source"
|
195 |
+
)
|
196 |
+
input_target = gr.Image(
|
197 |
+
type="pil",
|
198 |
+
label="Input Target"
|
199 |
+
)
|
200 |
run_button = gr.Button("Generate")
|
201 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
with gr.Column():
|
203 |
result = gr.Image(type='pil', label='Image Output')
|
204 |
+
|
|
|
|
|
|
|
205 |
run_button.click(
|
206 |
fn=infer_headswap,
|
207 |
inputs=[input_source, input_target],
|