Spaces:
Running
on
L4
Running
on
L4
flamehaze1115
commited on
Commit
·
09e9525
1
Parent(s):
c704d5b
Update app.py
Browse files
app.py
CHANGED
@@ -66,13 +66,13 @@ class SAMAPI:
|
|
66 |
predictor = None
|
67 |
|
68 |
@staticmethod
|
69 |
-
|
70 |
def get_instance(sam_checkpoint=None):
|
71 |
if SAMAPI.predictor is None:
|
72 |
if sam_checkpoint is None:
|
73 |
-
sam_checkpoint = "
|
74 |
if not os.path.exists(sam_checkpoint):
|
75 |
-
os.makedirs('
|
76 |
urllib.request.urlretrieve(
|
77 |
"https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth",
|
78 |
sam_checkpoint
|
|
|
66 |
predictor = None
|
67 |
|
68 |
@staticmethod
|
69 |
+
@st.cache_resource
|
70 |
def get_instance(sam_checkpoint=None):
|
71 |
if SAMAPI.predictor is None:
|
72 |
if sam_checkpoint is None:
|
73 |
+
sam_checkpoint = "tmp/sam_vit_h_4b8939.pth"
|
74 |
if not os.path.exists(sam_checkpoint):
|
75 |
+
os.makedirs('tmp', exist_ok=True)
|
76 |
urllib.request.urlretrieve(
|
77 |
"https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth",
|
78 |
sam_checkpoint
|