MaureenZOU commited on
Commit
f368476
1 Parent(s): 781344a
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -62,7 +62,7 @@ inference model
62
  def inference(image, task, *args, **kwargs):
63
  image = image.convert("RGB")
64
  with torch.autocast(device_type='cuda', dtype=torch.float16):
65
- if task == 'Referring Inpainting':
66
  return referring_inpainting(model_last, image, *args, **kwargs)
67
  elif task == 'Referring Segmentation':
68
  return referring_segmentation(model_last, image, *args, **kwargs)
@@ -88,7 +88,7 @@ title = "X-Decoder All-in-One Demo"
88
  description = "<p style='text-align: center'> <a href='' target='_blank'>Project Page</a> | <a href='' target='_blank'>Paper</a> | <a href='https://github.com/microsoft/X-Decoder' target='_blank'>Github Repo</a> | <a href='' target='_blank'>Video</a> </p>"
89
  article = "The Demo is Run on X-Decoder (Focal-T)."
90
 
91
- inputs = [gr.inputs.Image(type='pil'), gr.inputs.Radio(choices=["Referring Segmentation", 'Open Vocabulary Semantic Segmentation','Open Vocabulary Instance Segmentation', "Open Vocabulary Panoptic Segmentation", "Image Captioning", "Text Retrieval", "Referring Inpainting", "Referring Captioning (Beta)", "Image/Region Retrieval (Only Support Exampled 80 images)"], type="value", default="OpenVocab Semantic Segmentation", label="Task"), gr.Textbox(label="xdecoder_text"), gr.Textbox(label="inpainting_text"), gr.Textbox(label="task_description")]
92
  gr.Interface(
93
  fn=inference,
94
  inputs=inputs,
@@ -110,11 +110,11 @@ gr.Interface(
110
  ["./images/rose.webp", "Text Retrieval", "lily,rose,peoney,tulip", '', 'Format: s,s,s'],
111
  ["./images/region_retrieval.png", "Image/Region Retrieval (Only Support Exampled 80 images)", "The tangerine on the plate.", '', 'Please describe the object in a detailed way.'],
112
  ["./images/landscape.jpg", "Referring Captioning (Beta)", "cloud", '', 'Please fill in a noun/noun phrase. (may start with a/the)'],
113
- ["./images/apples.jpg", "Referring Inpainting", "a yellow apple", 'a pear', 'x-decoder + ldm (inference takes ~40s.)'],
114
  ],
115
  title=title,
116
  description=description,
117
  article=article,
118
  allow_flagging='never',
119
  cache_examples=True,
120
- ).launch(share=True)
 
62
  def inference(image, task, *args, **kwargs):
63
  image = image.convert("RGB")
64
  with torch.autocast(device_type='cuda', dtype=torch.float16):
65
+ if task == 'Referring Editing':
66
  return referring_inpainting(model_last, image, *args, **kwargs)
67
  elif task == 'Referring Segmentation':
68
  return referring_segmentation(model_last, image, *args, **kwargs)
 
88
  description = "<p style='text-align: center'> <a href='' target='_blank'>Project Page</a> | <a href='' target='_blank'>Paper</a> | <a href='https://github.com/microsoft/X-Decoder' target='_blank'>Github Repo</a> | <a href='' target='_blank'>Video</a> </p>"
89
  article = "The Demo is Run on X-Decoder (Focal-T)."
90
 
91
+ inputs = [gr.inputs.Image(type='pil'), gr.inputs.Radio(choices=["Referring Segmentation", 'Open Vocabulary Semantic Segmentation','Open Vocabulary Instance Segmentation', "Open Vocabulary Panoptic Segmentation", "Image Captioning", "Text Retrieval", "Referring Editing", "Referring Captioning (Beta)", "Image/Region Retrieval (Only Support Exampled 80 images)"], type="value", default="OpenVocab Semantic Segmentation", label="Task"), gr.Textbox(label="xdecoder_text"), gr.Textbox(label="inpainting_text"), gr.Textbox(label="task_description")]
92
  gr.Interface(
93
  fn=inference,
94
  inputs=inputs,
 
110
  ["./images/rose.webp", "Text Retrieval", "lily,rose,peoney,tulip", '', 'Format: s,s,s'],
111
  ["./images/region_retrieval.png", "Image/Region Retrieval (Only Support Exampled 80 images)", "The tangerine on the plate.", '', 'Please describe the object in a detailed way.'],
112
  ["./images/landscape.jpg", "Referring Captioning (Beta)", "cloud", '', 'Please fill in a noun/noun phrase. (may start with a/the)'],
113
+ ["./images/apples.jpg", "Referring Editing", "a yellow apple", 'a pear', 'x-decoder + ldm (inference takes ~20s), use inpainting_text "clean and empty scene" for image inpainting"'],
114
  ],
115
  title=title,
116
  description=description,
117
  article=article,
118
  allow_flagging='never',
119
  cache_examples=True,
120
+ ).launch()