MuhammmadRizwanRizwan commited on
Commit
f17375b
·
verified ·
1 Parent(s): fe76b10

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -27
app.py CHANGED
@@ -1,32 +1,32 @@
1
 
2
- # import streamlit as st
3
- # import numpy as np
4
- # import cv2
5
- # import warnings
6
- # import os
7
 
8
- # # Suppress warnings
9
- # warnings.filterwarnings("ignore", category=FutureWarning)
10
- # warnings.filterwarnings("ignore", category=UserWarning)
11
-
12
- # # Try importing TensorFlow
13
- # try:
14
- # from tensorflow.keras.models import load_model
15
- # from tensorflow.keras.preprocessing import image
16
- # except ImportError:
17
- # st.error("Failed to import TensorFlow. Please make sure it's installed correctly.")
18
-
19
- # # Try importing PyTorch and Detectron2
20
- # try:
21
- # import torch
22
- # import detectron2
23
- # except ImportError:
24
- # with st.spinner("Installing PyTorch and Detectron2..."):
25
- # os.system("pip install torch torchvision")
26
- # os.system("pip install 'git+https://github.com/facebookresearch/detectron2.git'")
27
-
28
- # import torch
29
- # import detectron2
30
 
31
 
32
  # import streamlit as st
 
1
 
2
+ import streamlit as st
3
+ import numpy as np
4
+ import cv2
5
+ import warnings
6
+ import os
7
 
8
+ # Suppress warnings
9
+ warnings.filterwarnings("ignore", category=FutureWarning)
10
+ warnings.filterwarnings("ignore", category=UserWarning)
11
+
12
+ # Try importing TensorFlow
13
+ try:
14
+ from tensorflow.keras.models import load_model
15
+ from tensorflow.keras.preprocessing import image
16
+ except ImportError:
17
+ st.error("Failed to import TensorFlow. Please make sure it's installed correctly.")
18
+
19
+ # Try importing PyTorch and Detectron2
20
+ try:
21
+ import torch
22
+ import detectron2
23
+ except ImportError:
24
+ with st.spinner("Installing PyTorch and Detectron2..."):
25
+ os.system("pip install torch torchvision")
26
+ os.system("pip install 'git+https://github.com/facebookresearch/detectron2.git'")
27
+
28
+ import torch
29
+ import detectron2
30
 
31
 
32
  # import streamlit as st