geshang commited on
Commit
691579e
·
verified ·
1 Parent(s): 7d7e76b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -13,6 +13,7 @@ import base64
13
  import cv2
14
  from typing import List, Tuple, Optional
15
  import sys
 
16
 
17
 
18
  def add_sam2_to_path():
@@ -230,6 +231,8 @@ def visualize_masks_on_image(
230
  blended = cv2.addWeighted(image_np, 1 - alpha, color_mask, alpha, 0)
231
  return PILImage.fromarray(blended)
232
 
 
 
233
  def run_pipeline(image: PILImage.Image, prompt: str):
234
  if not model or not processor:
235
  return "Models not loaded. Please check logs.", None
 
13
  import cv2
14
  from typing import List, Tuple, Optional
15
  import sys
16
+ import spaces
17
 
18
 
19
  def add_sam2_to_path():
 
231
  blended = cv2.addWeighted(image_np, 1 - alpha, color_mask, alpha, 0)
232
  return PILImage.fromarray(blended)
233
 
234
+ @torch.no_grad()
235
+ @spaces.GPU(duration=60)
236
  def run_pipeline(image: PILImage.Image, prompt: str):
237
  if not model or not processor:
238
  return "Models not loaded. Please check logs.", None