fffiloni commited on
Commit
ba7e9ef
·
verified ·
1 Parent(s): 0f2bdc3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import gradio as gr
2
 
3
  import torch
@@ -77,6 +78,7 @@ def visualize_all(pil_image, heatmaps, bboxes, inout_scores, inout_thresh=0.5):
77
 
78
  return overlay_image
79
 
 
80
  def main(image_input, progress=gr.Progress(track_tqdm=True)):
81
  # load image
82
  image = Image.open(image_input)
@@ -148,6 +150,10 @@ with gr.Blocks(css=css) as demo:
148
  with gr.Column():
149
  input_image = gr.Image(label="Image Input", type="filepath")
150
  submit_button = gr.Button("Submit")
 
 
 
 
151
  with gr.Column():
152
  result = gr.Image(label="Result", columns=3)
153
  heatmaps = gr.Gallery(label="Heatmap")
 
1
+ import spaces
2
  import gradio as gr
3
 
4
  import torch
 
78
 
79
  return overlay_image
80
 
81
+ @spaces.GPU() # ZeroGPU ready
82
  def main(image_input, progress=gr.Progress(track_tqdm=True)):
83
  # load image
84
  image = Image.open(image_input)
 
150
  with gr.Column():
151
  input_image = gr.Image(label="Image Input", type="filepath")
152
  submit_button = gr.Button("Submit")
153
+ gr.Examples(
154
+ examples = ["examples/the_office.png", "examples/succession.png"]
155
+ inputs = [input_image]
156
+ )
157
  with gr.Column():
158
  result = gr.Image(label="Result", columns=3)
159
  heatmaps = gr.Gallery(label="Heatmap")