JunchuanYu commited on
Commit
0ebdb47
·
1 Parent(s): 8901ad6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -4,6 +4,7 @@ import matplotlib
4
  import matplotlib.pyplot as plt
5
  import numpy as np
6
  import torch
 
7
  import gradio as gr
8
 
9
  from PIL import Image
@@ -12,7 +13,7 @@ from segment_anything import SamAutomaticMaskGenerator, SamPredictor, sam_model_
12
 
13
  matplotlib.pyplot.switch_backend('Agg') # for matplotlib to work in gradio
14
 
15
- st.markdown(
16
  """
17
  # Segment Anything Model (SAM)
18
  ### A test on remote sensing data
@@ -71,5 +72,12 @@ with gr.Blocks() as demo:
71
 
72
  segment_image_button = gr.Button("Segment")
73
  segment_image_button.click(segment_image, inputs=[image], outputs=image_output)
74
-
 
 
 
 
 
 
 
75
  demo.launch()
 
4
  import matplotlib.pyplot as plt
5
  import numpy as np
6
  import torch
7
+ import glob
8
  import gradio as gr
9
 
10
  from PIL import Image
 
13
 
14
  matplotlib.pyplot.switch_backend('Agg') # for matplotlib to work in gradio
15
 
16
+ gr.markdown(
17
  """
18
  # Segment Anything Model (SAM)
19
  ### A test on remote sensing data
 
72
 
73
  segment_image_button = gr.Button("Segment")
74
  segment_image_button.click(segment_image, inputs=[image], outputs=image_output)
75
+ gr.Examples(
76
+ [
77
+ glob.glob('./images/*')
78
+ ],
79
+ image,
80
+ image_output,
81
+ segment_image)
82
+
83
  demo.launch()