HanningChen commited on
Commit
eb9b67e
·
1 Parent(s): f2f112a

Fix ImageBind import for Spaces (no editable install)

Browse files
Files changed (3) hide show
  1. .gitignore +6 -0
  2. requirements.txt +0 -3
  3. webui/runner.py +12 -3
.gitignore CHANGED
@@ -11,3 +11,9 @@ webui/uploads/
11
  webui/results/
12
  __pycache__/
13
  *.pyc
 
 
 
 
 
 
 
11
  webui/results/
12
  __pycache__/
13
  *.pyc
14
+
15
+ ImageBind/build/
16
+ ImageBind/*.egg-info/
17
+ **/__pycache__/
18
+ *.pyc
19
+ runs/
requirements.txt CHANGED
@@ -23,6 +23,3 @@ opencv-python-headless==4.10.0.84
23
  # --- Models / inference ---
24
  ultralytics==8.4.3
25
  open-clip-torch==2.24.0
26
-
27
- # --- Local ImageBind package ---
28
- -e ./ImageBind
 
23
  # --- Models / inference ---
24
  ultralytics==8.4.3
25
  open-clip-torch==2.24.0
 
 
 
webui/runner.py CHANGED
@@ -8,9 +8,18 @@ from PIL import Image, ImageDraw
8
 
9
  from ultralytics import YOLO, SAM
10
 
11
- from ImageBind.imagebind import data
12
- from ImageBind.imagebind.models import imagebind_model
13
- from ImageBind.imagebind.models.imagebind_model import ModalityType
 
 
 
 
 
 
 
 
 
14
 
15
  import open_clip
16
 
 
8
 
9
  from ultralytics import YOLO, SAM
10
 
11
+ # from ImageBind.imagebind import data
12
+ # from ImageBind.imagebind.models import imagebind_model
13
+ # from ImageBind.imagebind.models.imagebind_model import ModalityType
14
+ import sys
15
+ from pathlib import Path
16
+
17
+ REPO_ROOT = Path(__file__).resolve().parents[1] # repo/
18
+ sys.path.insert(0, str(REPO_ROOT / "ImageBind")) # so "import imagebind" works
19
+
20
+ from imagebind import data
21
+ from imagebind.models import imagebind_model
22
+ from imagebind.models.imagebind_model import ModalityType
23
 
24
  import open_clip
25