Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,18 @@
|
|
| 1 |
-
import
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 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
|