segments-arnaud commited on
Commit
7b6e051
1 Parent(s): 9974436

Small change

Browse files
Files changed (2) hide show
  1. app.py +7 -6
  2. requirements.txt +0 -1
app.py CHANGED
@@ -1,8 +1,6 @@
1
  import numpy as np
2
  import gradio as gr
3
  import segment_anything
4
- import imutils
5
- import numpy as np
6
  import base64
7
  import torch
8
  import typing
@@ -11,12 +9,10 @@ import subprocess
11
 
12
 
13
  def image_to_sam_image_embedding(
14
- image_url: str,
15
  model_size: typing.Literal["base", "large", "huge"] = "base",
16
  ) -> str:
17
  """Generate an image embedding."""
18
- # Load image
19
- image = imutils.url_to_image(image_url)
20
 
21
  # Select model size
22
  if model_size == "base":
@@ -80,7 +76,12 @@ if __name__ == "__main__":
80
  # Gradio app
81
  app = gr.Interface(
82
  fn=image_to_sam_image_embedding,
83
- inputs="text",
 
 
 
 
 
84
  outputs="text",
85
  )
86
  app.launch()
 
1
  import numpy as np
2
  import gradio as gr
3
  import segment_anything
 
 
4
  import base64
5
  import torch
6
  import typing
 
9
 
10
 
11
  def image_to_sam_image_embedding(
12
+ image: np.ndarray,
13
  model_size: typing.Literal["base", "large", "huge"] = "base",
14
  ) -> str:
15
  """Generate an image embedding."""
 
 
16
 
17
  # Select model size
18
  if model_size == "base":
 
76
  # Gradio app
77
  app = gr.Interface(
78
  fn=image_to_sam_image_embedding,
79
+ inputs=[
80
+ gr.inputs.Image(type="url", label="Image URL"),
81
+ gr.inputs.Radio(
82
+ choices=["base", "large", "huge"], label="Model Size", default="base"
83
+ ),
84
+ ],
85
  outputs="text",
86
  )
87
  app.launch()
requirements.txt CHANGED
@@ -1,7 +1,6 @@
1
  numpy==1.19.4
2
  torch==1.13.0
3
  torchvision
4
- imutils
5
  git+https://github.com/facebookresearch/segment-anything.git
6
  pycocotools
7
  onnxruntime
 
1
  numpy==1.19.4
2
  torch==1.13.0
3
  torchvision
 
4
  git+https://github.com/facebookresearch/segment-anything.git
5
  pycocotools
6
  onnxruntime