Sebastiankay commited on
Commit
bcbf694
·
verified ·
1 Parent(s): 0f64809

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +263 -260
app.py CHANGED
@@ -238,267 +238,270 @@ def inpaint(image, invert):
238
  result = np.concatenate([color, alpha], axis=2)
239
  return [result]
240
 
241
- block = gr.Blocks().queue()
242
- with block:
243
  gr.Markdown(DESCRIPTION)
244
- with gr.Row():
245
- gr.Markdown("## Canny Edge")
246
- with gr.Row():
247
- with gr.Column():
248
- # input_image = gr.Image(source='upload', type="numpy")
249
- input_image = gr.Image(label="Input Image", type="numpy", height=512)
250
- low_threshold = gr.Slider(label="low_threshold", minimum=1, maximum=255, value=100, step=1)
251
- high_threshold = gr.Slider(label="high_threshold", minimum=1, maximum=255, value=200, step=1)
252
- resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
253
- run_button = gr.Button("Run")
254
- # run_button = gr.Button(label="Run")
255
- with gr.Column():
256
- # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
257
- gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
258
- run_button.click(fn=canny, inputs=[input_image, resolution, low_threshold, high_threshold], outputs=[gallery])
259
-
260
- gr.Markdown("<hr>")
261
- with gr.Row():
262
- gr.Markdown("## HED Edge&nbsp;&quot;SoftEdge&quot;")
263
- with gr.Row():
264
- with gr.Column():
265
- # input_image = gr.Image(source='upload', type="numpy")
266
- input_image = gr.Image(label="Input Image", type="numpy", height=512)
267
- resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
268
- run_button = gr.Button("Run")
269
- # run_button = gr.Button(label="Run")
270
- with gr.Column():
271
- # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
272
- gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
273
- run_button.click(fn=hed, inputs=[input_image, resolution], outputs=[gallery])
274
-
275
- gr.Markdown("<hr>")
276
- with gr.Row():
277
- gr.Markdown("## Pidi Edge&nbsp;&quot;SoftEdge&quot;")
278
- with gr.Row():
279
- with gr.Column():
280
- # input_image = gr.Image(source='upload', type="numpy")
281
- input_image = gr.Image(label="Input Image", type="numpy", height=512)
282
- resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
283
- run_button = gr.Button("Run")
284
- # run_button = gr.Button(label="Run")
285
- with gr.Column():
286
- # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
287
- gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
288
- run_button.click(fn=pidi, inputs=[input_image, resolution], outputs=[gallery])
289
-
290
- gr.Markdown("<hr>")
291
- with gr.Row():
292
- gr.Markdown("## MLSD Edge")
293
- with gr.Row():
294
- with gr.Column():
295
- # input_image = gr.Image(source='upload', type="numpy")
296
- input_image = gr.Image(label="Input Image", type="numpy", height=512)
297
- value_threshold = gr.Slider(label="value_threshold", minimum=0.01, maximum=2.0, value=0.1, step=0.01)
298
- distance_threshold = gr.Slider(label="distance_threshold", minimum=0.01, maximum=20.0, value=0.1, step=0.01)
299
- resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=384, step=64)
300
- run_button = gr.Button("Run")
301
- # run_button = gr.Button(label="Run")
302
- with gr.Column():
303
- # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
304
- gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
305
- run_button.click(fn=mlsd, inputs=[input_image, resolution, value_threshold, distance_threshold], outputs=[gallery])
306
-
307
- gr.Markdown("<hr>")
308
- with gr.Row():
309
- gr.Markdown("## MIDAS Depth")
310
- with gr.Row():
311
- with gr.Column():
312
- # input_image = gr.Image(source='upload', type="numpy")
313
- input_image = gr.Image(label="Input Image", type="numpy", height=512)
314
- resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=384, step=64)
315
- run_button = gr.Button("Run")
316
- # run_button = gr.Button(label="Run")
317
- with gr.Column():
318
- # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
319
- gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
320
- run_button.click(fn=midas, inputs=[input_image, resolution], outputs=[gallery])
321
-
322
-
323
- gr.Markdown("<hr>")
324
- with gr.Row():
325
- gr.Markdown("## Zoe Depth")
326
- with gr.Row():
327
- with gr.Column():
328
- # input_image = gr.Image(source='upload', type="numpy")
329
- input_image = gr.Image(label="Input Image", type="numpy", height=512)
330
- resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
331
- run_button = gr.Button("Run")
332
- # run_button = gr.Button(label="Run")
333
- with gr.Column():
334
- # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
335
- gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
336
- run_button.click(fn=zoe, inputs=[input_image, resolution], outputs=[gallery])
337
-
338
- gr.Markdown("<hr>")
339
- with gr.Row():
340
- gr.Markdown("## Normal Bae")
341
- with gr.Row():
342
- with gr.Column():
343
- # input_image = gr.Image(source='upload', type="numpy")
344
- input_image = gr.Image(label="Input Image", type="numpy", height=512)
345
- resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
346
- run_button = gr.Button("Run")
347
- # run_button = gr.Button(label="Run")
348
- with gr.Column():
349
- # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
350
- gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
351
- run_button.click(fn=normalbae, inputs=[input_image, resolution], outputs=[gallery])
352
-
353
- gr.Markdown("<hr>")
354
- with gr.Row():
355
- gr.Markdown("## DWPose")
356
- with gr.Row():
357
- with gr.Column():
358
- # input_image = gr.Image(source='upload', type="numpy")
359
- input_image = gr.Image(label="Input Image", type="numpy", height=512)
360
- resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
361
- run_button = gr.Button("Run")
362
- # run_button = gr.Button(label="Run")
363
- with gr.Column():
364
- # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
365
- gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
366
- run_button.click(fn=dwpose, inputs=[input_image, resolution], outputs=[gallery])
367
-
368
- gr.Markdown("<hr>")
369
- with gr.Row():
370
- gr.Markdown("## Openpose")
371
- with gr.Row():
372
- with gr.Column():
373
- # input_image = gr.Image(source='upload', type="numpy")
374
- input_image = gr.Image(label="Input Image", type="numpy", height=512)
375
- hand_and_face = gr.Checkbox(label='Hand and Face', value=False)
376
- resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
377
- run_button = gr.Button("Run")
378
- # run_button = gr.Button(label="Run")
379
- with gr.Column():
380
- # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
381
- gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
382
- run_button.click(fn=openpose, inputs=[input_image, resolution, hand_and_face], outputs=[gallery])
383
-
384
- gr.Markdown("<hr>")
385
- with gr.Row():
386
- gr.Markdown("## Lineart Anime \n<p>Check Invert to use with Mochi Diffusion.")
387
- with gr.Row():
388
- with gr.Column():
389
- # input_image = gr.Image(source='upload', type="numpy")
390
- input_image = gr.Image(label="Input Image", type="numpy", height=512)
391
- invert = gr.Checkbox(label='Invert', value=True)
392
- resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
393
- run_button = gr.Button("Run")
394
- # run_button = gr.Button(label="Run")
395
- with gr.Column():
396
- # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
397
- gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
398
- run_button.click(fn=lineart_anime, inputs=[input_image, resolution, invert], outputs=[gallery])
399
-
400
- gr.Markdown("<hr>")
401
- with gr.Row():
402
- gr.Markdown("## Lineart \n<p>Check Invert to use with Mochi Diffusion. Inverted image can also be created here for use with ControlNet Scribble.")
403
- with gr.Row():
404
- with gr.Column():
405
- # input_image = gr.Image(source='upload', type="numpy")
406
- input_image = gr.Image(label="Input Image", type="numpy", height=512)
407
- coarse = gr.Checkbox(label='Using coarse model', value=False)
408
- invert = gr.Checkbox(label='Invert', value=True)
409
- resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
410
- run_button = gr.Button("Run")
411
- # run_button = gr.Button(label="Run")
412
- with gr.Column():
413
- # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
414
- gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
415
- run_button.click(fn=lineart, inputs=[input_image, resolution, coarse, invert], outputs=[gallery])
416
-
417
- gr.Markdown("<hr>")
418
- with gr.Row():
419
- gr.Markdown("## InPaint")
420
- with gr.Row():
421
- with gr.Column():
422
- # input_image = gr.Image(source='upload', type="numpy", tool="sketch", height=512)
423
- input_image = gr.ImageMask(sources="upload", type="numpy", height="auto")
424
- invert = gr.Checkbox(label='Invert Mask', value=False)
425
- run_button = gr.Button("Run")
426
- # run_button = gr.Button(label="Run")
427
- with gr.Column():
428
- # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
429
- gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
430
- run_button.click(fn=inpaint, inputs=[input_image, invert], outputs=[gallery])
431
-
432
- # with gr.Row():
433
- # gr.Markdown("## Uniformer Segmentation")
434
- # with gr.Row():
435
- # with gr.Column():
436
- # input_image = gr.Image(source='upload', type="numpy")
437
- # resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
438
- # run_button = gr.Button(label="Run")
439
- # with gr.Column():
440
- # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
441
- # run_button.click(fn=uniformer, inputs=[input_image, resolution], outputs=[gallery])
442
-
443
- gr.Markdown("<hr>")
444
- with gr.Row():
445
- gr.Markdown("## Oneformer COCO Segmentation")
446
- with gr.Row():
447
- with gr.Column():
448
- # input_image = gr.Image(source='upload', type="numpy")
449
- input_image = gr.Image(label="Input Image", type="numpy", height=512)
450
- resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
451
- run_button = gr.Button("Run")
452
- # run_button = gr.Button(label="Run")
453
- with gr.Column():
454
- # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
455
- gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
456
- run_button.click(fn=oneformer_coco, inputs=[input_image, resolution], outputs=[gallery])
457
-
458
- gr.Markdown("<hr>")
459
- with gr.Row():
460
- gr.Markdown("## Oneformer ADE20K Segmentation")
461
- with gr.Row():
462
- with gr.Column():
463
- # input_image = gr.Image(source='upload', type="numpy")
464
- input_image = gr.Image(label="Input Image", type="numpy", height=512)
465
- resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=640, step=64)
466
- run_button = gr.Button("Run")
467
- # run_button = gr.Button(label="Run")
468
- with gr.Column():
469
- # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
470
- gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
471
- run_button.click(fn=oneformer_ade20k, inputs=[input_image, resolution], outputs=[gallery])
472
-
473
- gr.Markdown("<hr>")
474
- with gr.Row():
475
- gr.Markdown("## Content Shuffle")
476
- with gr.Row():
477
- with gr.Column():
478
- # input_image = gr.Image(source='upload', type="numpy")
479
- input_image = gr.Image(label="Input Image", type="numpy", height=512)
480
- resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
481
- run_button = gr.Button("Run")
482
- # run_button = gr.Button(label="Run")
483
- with gr.Column():
484
- # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
485
- gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
486
- run_button.click(fn=content_shuffler, inputs=[input_image, resolution], outputs=[gallery])
487
-
488
- gr.Markdown("<hr>")
489
- with gr.Row():
490
- gr.Markdown("## Color Shuffle")
491
- with gr.Row():
492
- with gr.Column():
493
- # input_image = gr.Image(source='upload', type="numpy")
494
- input_image = gr.Image(label="Input Image", type="numpy", height=512)
495
- resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
496
- run_button = gr.Button("Run")
497
- # run_button = gr.Button(label="Run")
498
- with gr.Column():
499
- # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
500
- gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
 
 
 
 
501
  run_button.click(fn=color_shuffler, inputs=[input_image, resolution], outputs=[gallery])
502
 
503
 
504
- block.launch(server_name='0.0.0.0')
 
238
  result = np.concatenate([color, alpha], axis=2)
239
  return [result]
240
 
241
+ with gr.Blocks() as demo:
 
242
  gr.Markdown(DESCRIPTION)
243
+ with gr.Tab("Canny Edge"):
244
+ with gr.Row():
245
+ gr.Markdown("## Canny Edge")
246
+ with gr.Row():
247
+ with gr.Column():
248
+ # input_image = gr.Image(source='upload', type="numpy")
249
+ input_image = gr.Image(label="Input Image", type="numpy", height=512)
250
+ low_threshold = gr.Slider(label="low_threshold", minimum=1, maximum=255, value=100, step=1)
251
+ high_threshold = gr.Slider(label="high_threshold", minimum=1, maximum=255, value=200, step=1)
252
+ resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
253
+ run_button = gr.Button("Run")
254
+ # run_button = gr.Button(label="Run")
255
+ with gr.Column():
256
+ # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
257
+ gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
258
+ run_button.click(fn=canny, inputs=[input_image, resolution, low_threshold, high_threshold], outputs=[gallery])
259
+
260
+ with gr.Tab("HED Edge"):
261
+ with gr.Row():
262
+ gr.Markdown("## HED Edge&nbsp;&quot;SoftEdge&quot;")
263
+ with gr.Row():
264
+ with gr.Column():
265
+ # input_image = gr.Image(source='upload', type="numpy")
266
+ input_image = gr.Image(label="Input Image", type="numpy", height=512)
267
+ resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
268
+ run_button = gr.Button("Run")
269
+ # run_button = gr.Button(label="Run")
270
+ with gr.Column():
271
+ # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
272
+ gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
273
+ run_button.click(fn=hed, inputs=[input_image, resolution], outputs=[gallery])
274
+
275
+ with gr.Tab("Pidi Edge"):
276
+ with gr.Row():
277
+ gr.Markdown("## Pidi Edge&nbsp;&quot;SoftEdge&quot;")
278
+ with gr.Row():
279
+ with gr.Column():
280
+ # input_image = gr.Image(source='upload', type="numpy")
281
+ input_image = gr.Image(label="Input Image", type="numpy", height=512)
282
+ resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
283
+ run_button = gr.Button("Run")
284
+ # run_button = gr.Button(label="Run")
285
+ with gr.Column():
286
+ # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
287
+ gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
288
+ run_button.click(fn=pidi, inputs=[input_image, resolution], outputs=[gallery])
289
+
290
+ with gr.Tab("MLSD Edge"):
291
+ with gr.Row():
292
+ gr.Markdown("## MLSD Edge")
293
+ with gr.Row():
294
+ with gr.Column():
295
+ # input_image = gr.Image(source='upload', type="numpy")
296
+ input_image = gr.Image(label="Input Image", type="numpy", height=512)
297
+ value_threshold = gr.Slider(label="value_threshold", minimum=0.01, maximum=2.0, value=0.1, step=0.01)
298
+ distance_threshold = gr.Slider(label="distance_threshold", minimum=0.01, maximum=20.0, value=0.1, step=0.01)
299
+ resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=384, step=64)
300
+ run_button = gr.Button("Run")
301
+ # run_button = gr.Button(label="Run")
302
+ with gr.Column():
303
+ # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
304
+ gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
305
+ run_button.click(fn=mlsd, inputs=[input_image, resolution, value_threshold, distance_threshold], outputs=[gallery])
306
+
307
+ with gr.Tab("MIDAS Depth"):
308
+ with gr.Row():
309
+ gr.Markdown("## MIDAS Depth")
310
+ with gr.Row():
311
+ with gr.Column():
312
+ # input_image = gr.Image(source='upload', type="numpy")
313
+ input_image = gr.Image(label="Input Image", type="numpy", height=512)
314
+ resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=384, step=64)
315
+ run_button = gr.Button("Run")
316
+ # run_button = gr.Button(label="Run")
317
+ with gr.Column():
318
+ # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
319
+ gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
320
+ run_button.click(fn=midas, inputs=[input_image, resolution], outputs=[gallery])
321
+
322
+
323
+ with gr.Tab("ZOE Depth"):
324
+ with gr.Row():
325
+ gr.Markdown("## Zoe Depth")
326
+ with gr.Row():
327
+ with gr.Column():
328
+ # input_image = gr.Image(source='upload', type="numpy")
329
+ input_image = gr.Image(label="Input Image", type="numpy", height=512)
330
+ resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
331
+ run_button = gr.Button("Run")
332
+ # run_button = gr.Button(label="Run")
333
+ with gr.Column():
334
+ # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
335
+ gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
336
+ run_button.click(fn=zoe, inputs=[input_image, resolution], outputs=[gallery])
337
+
338
+ with gr.Tab("Normal Bae"):
339
+ with gr.Row():
340
+ gr.Markdown("## Normal Bae")
341
+ with gr.Row():
342
+ with gr.Column():
343
+ # input_image = gr.Image(source='upload', type="numpy")
344
+ input_image = gr.Image(label="Input Image", type="numpy", height=512)
345
+ resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
346
+ run_button = gr.Button("Run")
347
+ # run_button = gr.Button(label="Run")
348
+ with gr.Column():
349
+ # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
350
+ gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
351
+ run_button.click(fn=normalbae, inputs=[input_image, resolution], outputs=[gallery])
352
+
353
+ with gr.Tab("DWPose"):
354
+ with gr.Row():
355
+ gr.Markdown("## DWPose")
356
+ with gr.Row():
357
+ with gr.Column():
358
+ # input_image = gr.Image(source='upload', type="numpy")
359
+ input_image = gr.Image(label="Input Image", type="numpy", height=512)
360
+ resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
361
+ run_button = gr.Button("Run")
362
+ # run_button = gr.Button(label="Run")
363
+ with gr.Column():
364
+ # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
365
+ gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
366
+ run_button.click(fn=dwpose, inputs=[input_image, resolution], outputs=[gallery])
367
+
368
+ with gr.Tab("Openpose"):
369
+ with gr.Row():
370
+ gr.Markdown("## Openpose")
371
+ with gr.Row():
372
+ with gr.Column():
373
+ # input_image = gr.Image(source='upload', type="numpy")
374
+ input_image = gr.Image(label="Input Image", type="numpy", height=512)
375
+ hand_and_face = gr.Checkbox(label='Hand and Face', value=False)
376
+ resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
377
+ run_button = gr.Button("Run")
378
+ # run_button = gr.Button(label="Run")
379
+ with gr.Column():
380
+ # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
381
+ gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
382
+ run_button.click(fn=openpose, inputs=[input_image, resolution, hand_and_face], outputs=[gallery])
383
+
384
+ with gr.Tab("Lineart Anime"):
385
+ with gr.Row():
386
+ gr.Markdown("## Lineart Anime \n<p>Check Invert to use with Mochi Diffusion.")
387
+ with gr.Row():
388
+ with gr.Column():
389
+ # input_image = gr.Image(source='upload', type="numpy")
390
+ input_image = gr.Image(label="Input Image", type="numpy", height=512)
391
+ invert = gr.Checkbox(label='Invert', value=True)
392
+ resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
393
+ run_button = gr.Button("Run")
394
+ # run_button = gr.Button(label="Run")
395
+ with gr.Column():
396
+ # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
397
+ gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
398
+ run_button.click(fn=lineart_anime, inputs=[input_image, resolution, invert], outputs=[gallery])
399
+
400
+ with gr.Tab("Lineart"):
401
+ with gr.Row():
402
+ gr.Markdown("## Lineart \n<p>Check Invert to use with Mochi Diffusion. Inverted image can also be created here for use with ControlNet Scribble.")
403
+ with gr.Row():
404
+ with gr.Column():
405
+ # input_image = gr.Image(source='upload', type="numpy")
406
+ input_image = gr.Image(label="Input Image", type="numpy", height=512)
407
+ coarse = gr.Checkbox(label='Using coarse model', value=False)
408
+ invert = gr.Checkbox(label='Invert', value=True)
409
+ resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
410
+ run_button = gr.Button("Run")
411
+ # run_button = gr.Button(label="Run")
412
+ with gr.Column():
413
+ # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
414
+ gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
415
+ run_button.click(fn=lineart, inputs=[input_image, resolution, coarse, invert], outputs=[gallery])
416
+
417
+
418
+ with gr.Tab("InPaint"):
419
+ with gr.Row():
420
+ gr.Markdown("## InPaint")
421
+ with gr.Row():
422
+ with gr.Column():
423
+ # input_image = gr.Image(source='upload', type="numpy", tool="sketch", height=512)
424
+ input_image = gr.ImageMask(sources="upload", type="numpy", height="auto")
425
+ invert = gr.Checkbox(label='Invert Mask', value=False)
426
+ run_button = gr.Button("Run")
427
+ # run_button = gr.Button(label="Run")
428
+ with gr.Column():
429
+ # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
430
+ gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
431
+ run_button.click(fn=inpaint, inputs=[input_image, invert], outputs=[gallery])
432
+
433
+ # with gr.Row():
434
+ # gr.Markdown("## Uniformer Segmentation")
435
+ # with gr.Row():
436
+ # with gr.Column():
437
+ # input_image = gr.Image(source='upload', type="numpy")
438
+ # resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
439
+ # run_button = gr.Button(label="Run")
440
+ # with gr.Column():
441
+ # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
442
+ # run_button.click(fn=uniformer, inputs=[input_image, resolution], outputs=[gallery])
443
+
444
+
445
+ # with gr.Row():
446
+ # gr.Markdown("## Oneformer COCO Segmentation")
447
+ # with gr.Row():
448
+ # with gr.Column():
449
+ # input_image = gr.Image(source='upload', type="numpy")
450
+ # input_image = gr.Image(label="Input Image", type="numpy", height=512)
451
+ # resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
452
+ # run_button = gr.Button("Run")
453
+ # run_button = gr.Button(label="Run")
454
+ # with gr.Column():
455
+ # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
456
+ # gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
457
+ # run_button.click(fn=oneformer_coco, inputs=[input_image, resolution], outputs=[gallery])
458
+
459
+
460
+ # with gr.Row():
461
+ # gr.Markdown("## Oneformer ADE20K Segmentation")
462
+ # with gr.Row():
463
+ # with gr.Column():
464
+ # input_image = gr.Image(source='upload', type="numpy")
465
+ # input_image = gr.Image(label="Input Image", type="numpy", height=512)
466
+ # resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=640, step=64)
467
+ # run_button = gr.Button("Run")
468
+ # run_button = gr.Button(label="Run")
469
+ # with gr.Column():
470
+ # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
471
+ # gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
472
+ # run_button.click(fn=oneformer_ade20k, inputs=[input_image, resolution], outputs=[gallery])
473
+
474
+ with gr.Tab("Content Shuffle"):
475
+ with gr.Row():
476
+ gr.Markdown("## Content Shuffle")
477
+ with gr.Row():
478
+ with gr.Column():
479
+ # input_image = gr.Image(source='upload', type="numpy")
480
+ input_image = gr.Image(label="Input Image", type="numpy", height=512)
481
+ resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
482
+ run_button = gr.Button("Run")
483
+ # run_button = gr.Button(label="Run")
484
+ with gr.Column():
485
+ # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
486
+ gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
487
+ run_button.click(fn=content_shuffler, inputs=[input_image, resolution], outputs=[gallery])
488
+
489
+ with gr.Tab("Color Shuffle"):
490
+ with gr.Row():
491
+ gr.Markdown("## Color Shuffle")
492
+ with gr.Row():
493
+ with gr.Column():
494
+ # input_image = gr.Image(source='upload', type="numpy")
495
+ input_image = gr.Image(label="Input Image", type="numpy", height=512)
496
+ resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
497
+ run_button = gr.Button("Run")
498
+ # run_button = gr.Button(label="Run")
499
+ with gr.Column():
500
+ # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
501
+ gallery = gr.Gallery(label="Generated images", show_label=False, height="auto")
502
+
503
+
504
  run_button.click(fn=color_shuffler, inputs=[input_image, resolution], outputs=[gallery])
505
 
506
 
507
+ demo.launch()