Spaces:
Runtime error
Runtime error
JunchuanYu
commited on
Commit
·
6c92cdf
1
Parent(s):
6798448
Update app.py
Browse files
app.py
CHANGED
@@ -1,15 +1,4 @@
|
|
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
|
@@ -22,8 +11,18 @@ import gradio as gr
|
|
22 |
from PIL import Image
|
23 |
from segment_anything import SamAutomaticMaskGenerator, SamPredictor, sam_model_registry
|
24 |
import logging
|
25 |
-
from
|
|
|
|
|
|
|
|
|
|
|
26 |
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
|
29 |
matplotlib.pyplot.switch_backend('Agg') # for matplotlib to work in gradio
|
|
|
1 |
+
import sys
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
import os
|
3 |
import cv2
|
4 |
import matplotlib
|
|
|
11 |
from PIL import Image
|
12 |
from segment_anything import SamAutomaticMaskGenerator, SamPredictor, sam_model_registry
|
13 |
import logging
|
14 |
+
from huggingface_hub import login
|
15 |
+
from huggingface_hub import Repository
|
16 |
+
from huggingface_hub import hf_hub_download
|
17 |
+
# os.system("python -m pip install --upgrade pip")
|
18 |
+
os.system("pip uninstall -y gradio")
|
19 |
+
os.system("pip install gradio==3.27.0")
|
20 |
|
21 |
+
token = os.environ['HUB_TOKEN']
|
22 |
+
loc =hf_hub_download(repo_id="JunchuanYu/files_for_segmentRS", filename="utils.py",repo_type="dataset",local_dir='.',token=token)
|
23 |
+
print(loc)
|
24 |
+
sys.path.append(loc)
|
25 |
+
from utils import *
|
26 |
|
27 |
|
28 |
matplotlib.pyplot.switch_backend('Agg') # for matplotlib to work in gradio
|