Spaces:
Sleeping
Sleeping
added checkpoint
Browse files
app.py
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import numpy as np
|
| 3 |
from PIL import Image
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import subprocess
|
| 3 |
+
|
| 4 |
+
# --- Ensure SAM checkpoint is present ---
|
| 5 |
+
SAM_CHECKPOINT = "sam_vit_h_4b8939.pth"
|
| 6 |
+
if not os.path.exists(SAM_CHECKPOINT):
|
| 7 |
+
print("Downloading SAM checkpoint...")
|
| 8 |
+
subprocess.run([
|
| 9 |
+
"wget",
|
| 10 |
+
"https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth"
|
| 11 |
+
])
|
| 12 |
+
# ----------------------------------------
|
| 13 |
import gradio as gr
|
| 14 |
import numpy as np
|
| 15 |
from PIL import Image
|