Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -2,45 +2,25 @@ import spaces
|
|
2 |
import os
|
3 |
import gradio as gr
|
4 |
import shutil
|
|
|
|
|
5 |
|
6 |
-
@spaces.GPU
|
7 |
-
def find_cuda():
|
8 |
-
# Check if CUDA_HOME or CUDA_PATH environment variables are set
|
9 |
-
cuda_home = os.environ.get('CUDA_HOME') or os.environ.get('CUDA_PATH')
|
10 |
|
11 |
-
if cuda_home and os.path.exists(cuda_home):
|
12 |
-
return cuda_home
|
13 |
|
14 |
-
# Search for the nvcc executable in the system's PATH
|
15 |
-
nvcc_path = shutil.which('nvcc')
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
if cuda_path:
|
27 |
-
print(f"CUDA installation found at: {cuda_path}")
|
28 |
-
else:
|
29 |
-
print("CUDA installation not found")
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
@spaces.GPU(duration=180)
|
34 |
-
def install_setup():
|
35 |
-
os.system("pip install git+https://github.com/facebookresearch/detectron2.git")
|
36 |
-
os.system("git clone https://github.com/Visual-AI/Mr.DETR.git MrDETR && cd MrDETR && rm -f requirements.txt && cd ..")
|
37 |
-
# os.system("cp multi_scale_deform_attn.py MrDETR/detrex/layers/ && cd MrDETR && pip install . & cd ..")
|
38 |
-
# os.system("cd MrDETR && export CUDA_HOME=$(dirname $(dirname $(which nvcc))) && pip install . & cd ..")
|
39 |
-
os.system("cd MrDETR && pip install . & cd ..")
|
40 |
-
import sys
|
41 |
-
sys.path.append("MrDETR/")
|
42 |
install_setup()
|
43 |
|
|
|
|
|
44 |
|
45 |
from demo.predictors import VisualizationDemo
|
46 |
from detectron2.checkpoint import DetectionCheckpointer
|
|
|
2 |
import os
|
3 |
import gradio as gr
|
4 |
import shutil
|
5 |
+
import sys
|
6 |
+
import subprocess
|
7 |
|
|
|
|
|
|
|
|
|
8 |
|
|
|
|
|
9 |
|
|
|
|
|
10 |
|
11 |
+
os.system("pip install git+https://github.com/facebookresearch/detectron2.git")
|
12 |
+
os.system("git clone https://github.com/Visual-AI/Mr.DETR.git MrDETR && cd MrDETR && rm -f requirements.txt && cd ..")
|
13 |
+
subprocess.run(
|
14 |
+
shlex.split(
|
15 |
+
"pip install detrex-0.3.0-cp310-cp310-linux_x86_64.whl"
|
16 |
+
)
|
17 |
+
)
|
18 |
+
|
19 |
+
sys.path.append("MrDETR/")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
install_setup()
|
21 |
|
22 |
+
detrex-0.3.0-cp310-cp310-linux_x86_64.whl
|
23 |
+
|
24 |
|
25 |
from demo.predictors import VisualizationDemo
|
26 |
from detectron2.checkpoint import DetectionCheckpointer
|