SauravMaheshkar
commited on
Commit
•
3d74359
1
Parent(s):
410698b
feat: try switching to ZeroGPU
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
-
|
|
|
2 |
|
3 |
import cv2
|
4 |
import gradio as gr
|
@@ -10,7 +11,11 @@ from sam2.sam2_image_predictor import SAM2ImagePredictor
|
|
10 |
|
11 |
from src.plot_utils import export_mask
|
12 |
|
|
|
13 |
|
|
|
|
|
|
|
14 |
def predict(model_choice, annotations: Dict[str, Any]):
|
15 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
16 |
sam2_model = load_model(
|
|
|
1 |
+
import os
|
2 |
+
from typing import Any, Dict
|
3 |
|
4 |
import cv2
|
5 |
import gradio as gr
|
|
|
11 |
|
12 |
from src.plot_utils import export_mask
|
13 |
|
14 |
+
from spaces import GPU
|
15 |
|
16 |
+
os.environ["ZEROGPU_V2"] = "true"
|
17 |
+
|
18 |
+
@GPU()
|
19 |
def predict(model_choice, annotations: Dict[str, Any]):
|
20 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
21 |
sam2_model = load_model(
|