Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import gradio as gr
|
2 |
-
|
3 |
import argparse
|
4 |
import cv2
|
5 |
from PIL import Image
|
@@ -23,6 +23,7 @@ device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
23 |
processor = AutoProcessor.from_pretrained(model_id)
|
24 |
model = AutoModelForZeroShotObjectDetection.from_pretrained(model_id).to(device)
|
25 |
|
|
|
26 |
def run_grounding(input_image, grounding_caption, box_threshold, text_threshold):
|
27 |
# Convert numpy array to PIL Image if needed
|
28 |
if isinstance(input_image, np.ndarray):
|
|
|
1 |
import gradio as gr
|
2 |
+
import spaces
|
3 |
import argparse
|
4 |
import cv2
|
5 |
from PIL import Image
|
|
|
23 |
processor = AutoProcessor.from_pretrained(model_id)
|
24 |
model = AutoModelForZeroShotObjectDetection.from_pretrained(model_id).to(device)
|
25 |
|
26 |
+
@spaces.GPU
|
27 |
def run_grounding(input_image, grounding_caption, box_threshold, text_threshold):
|
28 |
# Convert numpy array to PIL Image if needed
|
29 |
if isinstance(input_image, np.ndarray):
|