atatakun commited on
Commit
a87b051
1 Parent(s): 8d9ca28

Update app.py

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