Spaces:
Runtime error
Runtime error
JunchuanYu
commited on
Commit
·
6798448
1
Parent(s):
c1eb617
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import os
|
2 |
import cv2
|
3 |
import matplotlib
|
@@ -11,20 +23,9 @@ from PIL import Image
|
|
11 |
from segment_anything import SamAutomaticMaskGenerator, SamPredictor, sam_model_registry
|
12 |
import logging
|
13 |
from utils import *
|
14 |
-
from huggingface_hub import login
|
15 |
-
from huggingface_hub import Repository
|
16 |
-
# os.system("python -m pip install --upgrade pip")
|
17 |
-
os.system("pip uninstall -y gradio")
|
18 |
-
os.system("pip install gradio==3.27.0")
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
local_dir="files",
|
23 |
-
repo_type="dataset",
|
24 |
-
clone_from="JunchuanYu/files_for_segmentRS",
|
25 |
-
token=True
|
26 |
-
)
|
27 |
-
repo.git_pull()
|
28 |
matplotlib.pyplot.switch_backend('Agg') # for matplotlib to work in gradio
|
29 |
#setup model
|
30 |
sam_checkpoint = "sam_vit_h_4b8939.pth"
|
|
|
1 |
+
|
2 |
+
import os
|
3 |
+
from huggingface_hub import login
|
4 |
+
from huggingface_hub import Repository
|
5 |
+
from huggingface_hub import hf_hub_download
|
6 |
+
# os.system("python -m pip install --upgrade pip")
|
7 |
+
os.system("pip uninstall -y gradio")
|
8 |
+
os.system("pip install gradio==3.27.0")
|
9 |
+
|
10 |
+
token = os.environ['HUB_TOKEN']
|
11 |
+
hf_hub_download(repo_id="JunchuanYu/files_for_segmentRS", filename="utils.py",local_dir='.',token=token)
|
12 |
+
|
13 |
import os
|
14 |
import cv2
|
15 |
import matplotlib
|
|
|
23 |
from segment_anything import SamAutomaticMaskGenerator, SamPredictor, sam_model_registry
|
24 |
import logging
|
25 |
from utils import *
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
+
|
28 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
matplotlib.pyplot.switch_backend('Agg') # for matplotlib to work in gradio
|
30 |
#setup model
|
31 |
sam_checkpoint = "sam_vit_h_4b8939.pth"
|