Spaces:
Runtime error
Runtime error
Martin Tomov commited on
app.py segment anything pip install
Browse files
app.py
CHANGED
|
@@ -1,9 +1,16 @@
|
|
| 1 |
try:
|
| 2 |
import detectron2
|
| 3 |
-
except:
|
| 4 |
import os
|
| 5 |
os.system('pip install git+https://github.com/facebookresearch/detectron2.git')
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
import gradio as gr
|
| 8 |
import json
|
| 9 |
import numpy as np
|
|
|
|
| 1 |
try:
|
| 2 |
import detectron2
|
| 3 |
+
except ImportError:
|
| 4 |
import os
|
| 5 |
os.system('pip install git+https://github.com/facebookresearch/detectron2.git')
|
| 6 |
|
| 7 |
+
try:
|
| 8 |
+
from segment_anything import build_sam, SamPredictor
|
| 9 |
+
except ImportError:
|
| 10 |
+
import os
|
| 11 |
+
os.system('pip install git+https://github.com/facebookresearch/segment-anything.git')
|
| 12 |
+
from segment_anything import build_sam, SamPredictor
|
| 13 |
+
|
| 14 |
import gradio as gr
|
| 15 |
import json
|
| 16 |
import numpy as np
|