PUSHPENDAR commited on
Commit
2e01643
·
verified ·
1 Parent(s): f369aab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -8
app.py CHANGED
@@ -1,12 +1,18 @@
1
- import os, sys, subprocess
2
 
3
- # install detectron2 during space build
4
- if not os.path.exists("detectron2"):
5
- subprocess.run(
6
- ["pip", "install",
7
- "git+https://github.com/facebookresearch/detectron2.git"],
8
- check=True
9
- )
 
 
 
 
 
 
10
  import gradio as gr
11
  import cv2
12
  import numpy as np
 
1
+ import torch, subprocess, sys
2
 
3
+ print("CUDA available:", torch.cuda.is_available())
4
+
5
+ try:
6
+ import detectron2
7
+ except:
8
+ print("Installing detectron2...")
9
+ subprocess.check_call([
10
+ sys.executable, "-m", "pip", "install",
11
+ "git+https://github.com/facebookresearch/detectron2.git"
12
+ ])
13
+ import detectron2
14
+
15
+ print("Detectron2 ready")
16
  import gradio as gr
17
  import cv2
18
  import numpy as np