File size: 2,651 Bytes
ee303e2
 
 
 
 
 
 
 
 
f32e461
d602b4d
 
 
 
f32e461
 
 
 
 
 
 
 
 
 
d602b4d
f32e461
 
 
 
 
ee303e2
 
 
f32e461
ee303e2
 
 
f32e461
 
 
 
ee303e2
 
 
 
 
 
 
 
f32e461
ee303e2
 
 
f32e461
 
ee303e2
 
 
 
 
 
 
 
 
 
 
 
 
 
f32e461
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import streamlit as st
import os 
import subprocess
import geocoder
import pandas as pd 
from csv import writer
# import keyboard
# st.title('Dawg Detection 🐶')
st.markdown("<h1 style='text-align: center; color: white;'>Dawg Detection 🐶</h1>", unsafe_allow_html=True)
jury=True
if 'jury' not in st.session_state:
    st.session_state.jury = False

butt=st.button('Configure',disabled=st.session_state.jury,help='Press This And Wait A Few Seconds If You Are Running The Website For The First Time')
if butt==True:
    os.system('git clone https://github.com/WongKinYiu/yolov7')
    os.system('%cd yolov7')
    os.system('pip install -r requirements.txt')
    os.system('ls')
    os.system('wget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7.pt')
    os.system('pip install opencv_python')
    os.system('conda install pytorch torchvision torchaudio -c pytorch -y')
    os.system('pip install pyyaml')
    os.system('pip install scipy')
    st.session_state.jury = True


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'
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'


pic=st.camera_input('Take A Picture')
if pic:
    with open ('Images/seesh.png','wb') as file:
        file.write(pic.getbuffer())
        os.system(bob)
        st.text('Detected Dawgs')
        img=st.image('runs/detect/exp/seesh.png')

        #count
        f=open("runs/detect/exp/labels/seesh.txt",'r')
        a=f.readlines()
        b=[]
        for j in range(0,len(a)):
            if a[j][0:2] == '16':
                b.append('yass')
            else:
                continue 
        print(len(b))
        f=open("runs/detect/exp/labels/seesh.txt",'w')
        st.balloons()
        st.success(f'Total Number Of Dogs Detected: {len(b)}')
        st.markdown("---")

        #map
        g = geocoder.ip('me')
        print(g.latlng)
        with open('database/cord.csv', 'a') as f_object:
            writer_object = writer(f_object)
            writer_object.writerow(g.latlng)
            f_object.close()
        df=pd.read_csv('database/cord.csv')
        cum=len(df['lat'])
        st.text(f'Your Location Coordinates: {g.latlng}')
        st.map(df,use_container_width=True,zoom = 4)
        st.markdown(f"<h5 style='color: red;'>Total Number Of Reports Around The World: {cum}<h5>", unsafe_allow_html=True)

clicked= st.button('Click Me For Balloons',help='Click here to feel happy 😁')
if clicked==True:
    st.balloons()