FantasticGNU commited on
Commit
1768414
β€’
1 Parent(s): 0a1ac14

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -24,6 +24,8 @@ from UniVAD.models.segment_anything import (
24
  SamPredictor,
25
  )
26
 
 
 
27
 
28
 
29
  device = "cuda" if torch.cuda.is_available() else "cpu"
@@ -61,7 +63,8 @@ def preprocess_image(img):
61
  def update_image(image):
62
  if image is not None:
63
  return preprocess_image(image)
64
-
 
65
  def ad(image_pil, normal_image, box_threshold, text_threshold, text_prompt, background_prompt, cluster_num):
66
  return process_image(image_pil, normal_image, box_threshold, text_threshold, sam_predictor, grounding_model, univad_model, ram_model, text_prompt, background_prompt, cluster_num, image_size, grounding_processor)
67
 
 
24
  SamPredictor,
25
  )
26
 
27
+ import spaces
28
+
29
 
30
 
31
  device = "cuda" if torch.cuda.is_available() else "cpu"
 
63
  def update_image(image):
64
  if image is not None:
65
  return preprocess_image(image)
66
+
67
+ @spaces.GPU
68
  def ad(image_pil, normal_image, box_threshold, text_threshold, text_prompt, background_prompt, cluster_num):
69
  return process_image(image_pil, normal_image, box_threshold, text_threshold, sam_predictor, grounding_model, univad_model, ram_model, text_prompt, background_prompt, cluster_num, image_size, grounding_processor)
70