Eemansleepdeprived commited on
Commit
f32e461
ยท
1 Parent(s): b77ab88

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -26
app.py CHANGED
@@ -7,34 +7,35 @@ from csv import writer
7
  # import keyboard
8
  # st.title('Dawg Detection ๐Ÿถ')
9
  st.markdown("<h1 style='text-align: center; color: white;'>Dawg Detection ๐Ÿถ</h1>", unsafe_allow_html=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
  pic=st.camera_input('Take A Picture')
12
- bob='python /Users/eemanmajumder/code_shit/Project_Exibition/yolov7/detect.py --weights /Users/eemanmajumder/code_shit/Project_Exibition/app/yolov7.pt --classes 16 --conf 0.25 --img-size 640 --source /Users/eemanmajumder/code_shit/Project_Exibition/yolov7/inference/images/seesh.png --exist-ok --save-conf --save-txt'
13
  if pic:
14
- with open ('yolov7/inference/images/seesh.png','wb') as file:
15
  file.write(pic.getbuffer())
16
- # keyboard.press_and_release('control+shift+`')
17
- # !python3 yolov7/detect.py --weights yolov7.pt --conf 0.25 --img-size 640 --source inference/images/seesh.png --classes 16 --exist-ok --save-conf --save-txt
18
- os.system('cd /Users/eemanmajumder/code_shit/Project_Exibition')
19
  os.system(bob)
20
- st.markdown("---")
21
  st.text('Detected Dawgs')
22
- img=st.image('/Users/eemanmajumder/code_shit/Project_Exibition/runs/detect/exp/seesh.png')
23
- names= [ 'person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', 'truck', 'boat', 'traffic light',
24
- 'fire hydrant', 'stop sign', 'parking meter', 'bench', 'bird', 'cat', 'dog', 'horse', 'sheep', 'cow',
25
- 'elephant', 'bear', 'zebra', 'giraffe', 'backpack', 'umbrella', 'handbag', 'tie', 'suitcase', 'frisbee',
26
- 'skis', 'snowboard', 'sports ball', 'kite', 'baseball bat', 'baseball glove', 'skateboard', 'surfboard',
27
- 'tennis racket', 'bottle', 'wine glass', 'cup', 'fork', 'knife', 'spoon', 'bowl', 'banana', 'apple',
28
- 'sandwich', 'orange', 'broccoli', 'carrot', 'hot dog', 'pizza', 'donut', 'cake', 'chair', 'couch',
29
- 'potted plant', 'bed', 'dining table', 'toilet', 'tv', 'laptop', 'mouse', 'remote', 'keyboard', 'cell phone',
30
- 'microwave', 'oven', 'toaster', 'sink', 'refrigerator', 'book', 'clock', 'vase', 'scissors', 'teddy bear',
31
- 'hair drier', 'toothbrush' ]
32
- len(names)
33
- d= {}
34
-
35
- for i in range(0,len(names)):
36
- d[names[i]]=i
37
- f=open("/Users/eemanmajumder/code_shit/Project_Exibition/runs/detect/exp/labels/seesh.txt",'r')
38
  a=f.readlines()
39
  b=[]
40
  for j in range(0,len(a)):
@@ -43,24 +44,25 @@ if pic:
43
  else:
44
  continue
45
  print(len(b))
46
- f=open("/Users/eemanmajumder/code_shit/Project_Exibition/runs/detect/exp/labels/seesh.txt",'w')
47
  st.balloons()
48
  st.success(f'Total Number Of Dogs Detected: {len(b)}')
49
  st.markdown("---")
 
 
50
  g = geocoder.ip('me')
51
  print(g.latlng)
52
-
53
  with open('database/cord.csv', 'a') as f_object:
54
  writer_object = writer(f_object)
55
  writer_object.writerow(g.latlng)
56
  f_object.close()
57
  df=pd.read_csv('database/cord.csv')
58
  cum=len(df['lat'])
59
- # df.to_csv('database/cord.csv',index=False)
60
  st.text(f'Your Location Coordinates: {g.latlng}')
61
  st.map(df,use_container_width=True,zoom = 4)
62
  st.markdown(f"<h5 style='color: red;'>Total Number Of Reports Around The World: {cum}<h5>", unsafe_allow_html=True)
63
 
64
  clicked= st.button('Click Me For Balloons',help='Click here to feel happy ๐Ÿ˜')
65
  if clicked==True:
66
- st.balloons()
 
 
7
  # import keyboard
8
  # st.title('Dawg Detection ๐Ÿถ')
9
  st.markdown("<h1 style='text-align: center; color: white;'>Dawg Detection ๐Ÿถ</h1>", unsafe_allow_html=True)
10
+ jury=True
11
+ butt=st.button('Configure',disabled=jury)
12
+ if butt==True:
13
+ os.system('git clone https://github.com/WongKinYiu/yolov7')
14
+ os.system('%cd yolov7')
15
+ os.system('pip install -r requirements.txt')
16
+ os.system('ls')
17
+ os.system('wget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7.pt')
18
+ os.system('pip install opencv_python')
19
+ os.system('conda install pytorch torchvision torchaudio -c pytorch -y')
20
+ os.system('pip install pyyaml')
21
+ os.system('pip install scipy')
22
+ jury=False
23
+
24
+
25
+ bob='python yolov7/detect.py --weights yolov7.pt --classes 16 --conf 0.25 --img-size 640 --source Images/seesh.png --exist-ok --save-conf --save-txt'
26
+ tusk='python yolov7/detect.py --weights yolov7.pt --classes 16 --conf 0.25 --img-size 640 --source Images/seesh.png --exist-ok --save-conf --save-txt'
27
+
28
 
29
  pic=st.camera_input('Take A Picture')
 
30
  if pic:
31
+ with open ('Images/seesh.png','wb') as file:
32
  file.write(pic.getbuffer())
 
 
 
33
  os.system(bob)
 
34
  st.text('Detected Dawgs')
35
+ img=st.image('runs/detect/exp/seesh.png')
36
+
37
+ #count
38
+ f=open("runs/detect/exp/labels/seesh.txt",'r')
 
 
 
 
 
 
 
 
 
 
 
 
39
  a=f.readlines()
40
  b=[]
41
  for j in range(0,len(a)):
 
44
  else:
45
  continue
46
  print(len(b))
47
+ f=open("runs/detect/exp/labels/seesh.txt",'w')
48
  st.balloons()
49
  st.success(f'Total Number Of Dogs Detected: {len(b)}')
50
  st.markdown("---")
51
+
52
+ #map
53
  g = geocoder.ip('me')
54
  print(g.latlng)
 
55
  with open('database/cord.csv', 'a') as f_object:
56
  writer_object = writer(f_object)
57
  writer_object.writerow(g.latlng)
58
  f_object.close()
59
  df=pd.read_csv('database/cord.csv')
60
  cum=len(df['lat'])
 
61
  st.text(f'Your Location Coordinates: {g.latlng}')
62
  st.map(df,use_container_width=True,zoom = 4)
63
  st.markdown(f"<h5 style='color: red;'>Total Number Of Reports Around The World: {cum}<h5>", unsafe_allow_html=True)
64
 
65
  clicked= st.button('Click Me For Balloons',help='Click here to feel happy ๐Ÿ˜')
66
  if clicked==True:
67
+ st.balloons()
68
+