justin-zk commited on
Commit
ef7fe6c
1 Parent(s): 26c5293

update app code

Browse files
Files changed (1) hide show
  1. app.py +19 -16
app.py CHANGED
@@ -480,16 +480,17 @@ description = """
480
  main = gr.Interface(
481
  fn=inference,
482
  inputs=[
483
- gr.Image(type="pil", label="in context image",),
484
- gr.Image(type="pil", label="in context mask"),
485
- gr.Image(type="pil", label="test image1"),
486
- gr.Image(type="pil", label="test image2"),
487
  ],
488
  outputs=[
489
- gr.components.Image(type="pil", label="output image1"),
490
- gr.components.Image(type="pil", label="output image2"),
491
  ],
492
  allow_flagging="never",
 
493
  title="Personalize Segment Anything Model with 1 Shot",
494
  description=description,
495
  examples=[
@@ -503,15 +504,16 @@ main = gr.Interface(
503
  main_scribble = gr.Interface(
504
  fn=inference_scribble,
505
  inputs=[
506
- gr.ImageMask(label="[Stroke] Draw on Image", type="pil"),
507
  gr.Image(type="pil", label="test image1"),
508
  gr.Image(type="pil", label="test image2"),
509
  ],
510
  outputs=[
511
- gr.components.Image(type="pil", label="output image1"),
512
- gr.components.Image(type="pil", label="output image2"),
513
  ],
514
  allow_flagging="never",
 
515
  title="Personalize Segment Anything Model with 1 Shot",
516
  description=description,
517
  examples=[
@@ -525,16 +527,17 @@ main_scribble = gr.Interface(
525
  main_finetune = gr.Interface(
526
  fn=inference_finetune,
527
  inputs=[
528
- gr.Image(type="pil", label="in context image"),
529
- gr.Image(type="pil", label="in context mask"),
530
- gr.Image(type="pil", label="test image1"),
531
- gr.Image(type="pil", label="test image2"),
532
  ],
533
  outputs=[
534
- gr.components.Image(type="pil", label="output image1"),
535
- gr.components.Image(type="pil", label="output image2"),
536
  ],
537
  allow_flagging="never",
 
538
  title="Personalize Segment Anything Model with 1 Shot",
539
  description=description,
540
  examples=[
@@ -552,4 +555,4 @@ with demo:
552
  ["Personalize-SAM", "Personalize-SAM-Scribble", "Personalize-SAM-F"],
553
  )
554
 
555
- demo.launch()
 
480
  main = gr.Interface(
481
  fn=inference,
482
  inputs=[
483
+ gr.Image(label="in context image",),
484
+ gr.Image(label="in context mask"),
485
+ gr.Image(label="test image1"),
486
+ gr.Image(label="test image2"),
487
  ],
488
  outputs=[
489
+ gr.Image(label="output image1").style(height=256, width=256),
490
+ gr.Image(label="output image2").style(height=256, width=256),
491
  ],
492
  allow_flagging="never",
493
+ cache_examples=False,
494
  title="Personalize Segment Anything Model with 1 Shot",
495
  description=description,
496
  examples=[
 
504
  main_scribble = gr.Interface(
505
  fn=inference_scribble,
506
  inputs=[
507
+ gr.ImageMask(label="[Stroke] Draw on Image", brush_radius=4),
508
  gr.Image(type="pil", label="test image1"),
509
  gr.Image(type="pil", label="test image2"),
510
  ],
511
  outputs=[
512
+ gr.Image(type="pil", label="output image1").style(height=256, width=256),
513
+ gr.Image(type="pil", label="output image2").style(height=256, width=256),
514
  ],
515
  allow_flagging="never",
516
+ cache_examples=False,
517
  title="Personalize Segment Anything Model with 1 Shot",
518
  description=description,
519
  examples=[
 
527
  main_finetune = gr.Interface(
528
  fn=inference_finetune,
529
  inputs=[
530
+ gr.Image(label="in context image",),
531
+ gr.Image(label="in context mask"),
532
+ gr.Image(label="test image1"),
533
+ gr.Image(label="test image2"),
534
  ],
535
  outputs=[
536
+ gr.Image(label="output image1").style(height=256, width=256),
537
+ gr.Image(label="output image2").style(height=256, width=256),
538
  ],
539
  allow_flagging="never",
540
+ cache_examples=False,
541
  title="Personalize Segment Anything Model with 1 Shot",
542
  description=description,
543
  examples=[
 
555
  ["Personalize-SAM", "Personalize-SAM-Scribble", "Personalize-SAM-F"],
556
  )
557
 
558
+ demo.launch(enable_queue=False)