msagbohan commited on
Commit
125be70
·
verified ·
1 Parent(s): 9ee6578

Delete main.py

Browse files
Files changed (1) hide show
  1. main.py +0 -130
main.py DELETED
@@ -1,130 +0,0 @@
1
- import streamlit as st
2
- from streamlit_option_menu import option_menu
3
- import pyrebase
4
-
5
- import annotator
6
-
7
- # APP PAGE SETTINGS
8
-
9
- st.set_page_config(page_title="BAMSCAPE", page_icon=":bird:", layout='wide', initial_sidebar_state='auto')
10
-
11
- st.markdown("""
12
- <style>
13
- .css-o18uir.e16nr0p33 {
14
- margin-top: -75px;
15
- }
16
- </style>
17
- """, unsafe_allow_html=True)
18
-
19
- st.markdown(
20
- """
21
- <style>
22
- div.stButton > button {background-color: #64B5F6;}
23
- div.Controls_container__LTeAA > button {background: purple !important;}
24
- .block-container {
25
- padding-top: 2.5rem;
26
- padding-bottom: 0rem;
27
- padding-left: 5rem;
28
- padding-right: 5rem;
29
- }
30
-
31
- iframe[title="streamlit_text_label.label_select"] .ant-btn {background: orange !important;}
32
- iframe[title="streamlit_text_label.label_select"] .ant-btn-primary {background: orange !important;}
33
- .ant-btn {background: violet !important;}
34
- .ant-btn-primary {background: violet !important;}
35
- button.ant-btn {background: violet !important;}
36
- button.ant-btn-primary {background: violet !important;}
37
- </style>
38
- """, unsafe_allow_html=True
39
- )
40
-
41
- # MAIN PAGE HEADER
42
-
43
- col1, col2 = st.columns((1, 10))
44
- with col1:
45
- st.image('bioacoustics_logo_large2.gif', width=90)
46
- with col2:
47
- st.header(':green[Brazilian Team] &mdash;' ' ' ':violet[_Bioacoustics_ :bird:]')
48
-
49
- # FIREBASE KEYS AND AUTHENTICATION
50
-
51
- firebaseConfig = {
52
- 'apiKey': st.secrets["config_firebase"]['apiKey'],
53
- 'authDomain': st.secrets["config_firebase"]['authDomain'],
54
- 'projectId': st.secrets["config_firebase"]['projectId'],
55
- 'databaseURL': st.secrets["config_firebase"]['databaseURL'],
56
- 'storageBucket': st.secrets["config_firebase"]['storageBucket'],
57
- 'messagingSenderId': st.secrets["config_firebase"]['messagingSenderId'],
58
- 'appId': st.secrets["config_firebase"]['appId'],
59
- 'measurementId': st.secrets["config_firebase"]['measurementId'],
60
- }
61
-
62
- fire = pyrebase.initialize_app(firebaseConfig)
63
- auth = fire.auth()
64
-
65
- # DATABASE
66
-
67
- db = fire.database()
68
- storage = fire.storage()
69
-
70
- # MAIN APP
71
-
72
- if 'useremail' not in st.session_state:
73
- st.session_state.useremail = ''
74
-
75
-
76
- def f():
77
- try:
78
- auth.sign_in_with_email_and_password(email, password)
79
- st.session_state.signout = True
80
- st.session_state.signedout = True
81
- st.session_state.useremail = email
82
- except:
83
- st.text(' ')
84
-
85
-
86
- def t():
87
- st.session_state.signout = False
88
- st.session_state.signedout = False
89
-
90
-
91
- if 'signedout' not in st.session_state:
92
- st.session_state['signedout'] = False
93
-
94
- if 'signout' not in st.session_state:
95
- st.session_state['signout'] = False
96
-
97
- if not st.session_state['signedout']:
98
- st.subheader(':orange[Please, login to the interface]')
99
- email = st.text_input(':blue[E-mail]', placeholder='Enter your e-mail')
100
- password = st.text_input(':blue[Password]', placeholder='Enter your password', type='password')
101
-
102
- if st.button('Login', on_click=f):
103
- try:
104
- auth.sign_in_with_email_and_password(email, password)
105
- st.session_state.useremail = email
106
- st.session_state.signout = True
107
- st.session_state.signedout = True
108
-
109
- except:
110
- st.warning('Login failed, please enter a valid email/password')
111
-
112
- if st.session_state.signout:
113
- username = st.session_state.useremail
114
- username = username.split('@')[0]
115
- st.subheader(f':blue[Hello]' + ' ' + f':gray[{username}]' + ' ' + '👋🏻')
116
- st.button('Sign out', on_click=t)
117
- st.markdown('#####')
118
- bio = option_menu(menu_title=None,
119
- options=['Home', 'Database', 'Data analysis', 'Identification'],
120
- icons=['house', 'volume-up', 'soundwave', 'layers'],
121
- default_index=0,
122
- styles={"nav-link": {"font-size": "17px", "text-align": "left", "margin": "0px"},
123
- "nav-link-selected": {"background-color": "orange"}},
124
- orientation='horizontal')
125
-
126
- if bio == 'Identification':
127
- annotator.iden()
128
-
129
- st.markdown('#')
130
-