Federico Galatolo commited on
Commit
e0a47a2
1 Parent(s): 31a9a65

install detectron2 from script

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -1,9 +1,16 @@
 
1
  import streamlit as st
 
 
 
 
 
 
 
2
  import cv2
3
  import sys
4
  import argparse
5
  import numpy as np
6
- import os
7
  import json
8
  import torch
9
  import torch.nn.functional as F
@@ -13,6 +20,7 @@ from collections import OrderedDict
13
  from scipy import spatial
14
  import matplotlib.pyplot as plt
15
 
 
16
  from detectron2.engine import DefaultPredictor
17
  from detectron2.utils.visualizer import Visualizer
18
  from detectron2.config import get_cfg
 
1
+ import os
2
  import streamlit as st
3
+
4
+ try:
5
+ import detectron2
6
+ except:
7
+ with st.spinner("Installing detectron2"):
8
+ os.system("pip install detectron2 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cpu/torch1.10/index.html")
9
+
10
  import cv2
11
  import sys
12
  import argparse
13
  import numpy as np
 
14
  import json
15
  import torch
16
  import torch.nn.functional as F
 
20
  from scipy import spatial
21
  import matplotlib.pyplot as plt
22
 
23
+
24
  from detectron2.engine import DefaultPredictor
25
  from detectron2.utils.visualizer import Visualizer
26
  from detectron2.config import get_cfg