Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -18,7 +18,7 @@ def process_image(image, prompts):
|
|
18 |
preds = outputs.logits.unsqueeze(1)
|
19 |
|
20 |
filename = f"mask.png"
|
21 |
-
plt.imsave(filename,torch.sigmoid(preds[
|
22 |
|
23 |
img2 = cv2.imread(filename)
|
24 |
gray_image = cv2.cvtColor(img2, cv2.COLOR_BGR2GRAY)
|
@@ -34,7 +34,7 @@ title = "Interactive demo: zero-shot image segmentation with CLIPSeg"
|
|
34 |
description = "Demo for using CLIPSeg, a CLIP-based model for zero- and one-shot image segmentation. To use it, simply upload an image and add a text to mask (identify in the image), or use one of the examples below and click 'submit'. Results will show up in a few seconds."
|
35 |
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2112.10003'>CLIPSeg: Image Segmentation Using Text and Image Prompts</a> | <a href='https://huggingface.co/docs/transformers/main/en/model_doc/clipseg'>HuggingFace docs</a></p>"
|
36 |
|
37 |
-
examples = [["example_image.png", "
|
38 |
|
39 |
interface = gr.Interface(fn=process_image,
|
40 |
inputs=[gr.Image(type="pil"), gr.Textbox(label="What do you want to identify (separated by comma)?")],
|
|
|
18 |
preds = outputs.logits.unsqueeze(1)
|
19 |
|
20 |
filename = f"mask.png"
|
21 |
+
plt.imsave(filename,torch.sigmoid(preds[0][0]))
|
22 |
|
23 |
img2 = cv2.imread(filename)
|
24 |
gray_image = cv2.cvtColor(img2, cv2.COLOR_BGR2GRAY)
|
|
|
34 |
description = "Demo for using CLIPSeg, a CLIP-based model for zero- and one-shot image segmentation. To use it, simply upload an image and add a text to mask (identify in the image), or use one of the examples below and click 'submit'. Results will show up in a few seconds."
|
35 |
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2112.10003'>CLIPSeg: Image Segmentation Using Text and Image Prompts</a> | <a href='https://huggingface.co/docs/transformers/main/en/model_doc/clipseg'>HuggingFace docs</a></p>"
|
36 |
|
37 |
+
examples = [["example_image.png", "wood"]]
|
38 |
|
39 |
interface = gr.Interface(fn=process_image,
|
40 |
inputs=[gr.Image(type="pil"), gr.Textbox(label="What do you want to identify (separated by comma)?")],
|