File size: 1,915 Bytes
c44d66d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Import libraries
import datetime
import os
import streamlit as st
from PIL import Image
from streamlit_extras.switch_page_button import switch_page
from baam_functions import *
from pathlib import Path

# Set parent direction as current folder
sourceFileDir = Path(
    os.path.dirname(os.path.abspath(__file__))).parent.absolute()
os.chdir(sourceFileDir)

logo = Image.open('img/logo.png')
st.set_page_config(page_title="BAAM", page_icon=logo)


def main():
    # Get user_dict & verification from previous page
    user_dict = st.session_state['user_dict']

    # Get username from user_dict
    username = user_dict.get('username', '')

    # Header of the page
    col1, col2, col3 = st.columns([6, 6, 2])
    with col1:
        st.subheader("Welcome " + username)
    with col2:
        st.write(' ')
    with col3:
        st.image("img/Standard_Chartered.png", width=100)

    # Body of the page
    col1, col2 = st.columns(2)
    # Bank sidebar
    with col1:
        st.image("img/bank_sidebar.png")
    # Transaction information page to transfer money
    with col2:
        #  Check face verification
        st.info('Please take a photo to verify your face')
        img_file_buffer = st.camera_input("Take a picture")
        if img_file_buffer:
            face_verification = verify_face(username, img_file_buffer)
            # If passed face verification
            if face_verification:
                st.info("Congrats! You passed face verification")
                # Store information to the database
                add_login_data(user_dict)
                # Update verification status
                st.session_state['verification'] = face_verification
                st.image("img/sent.png", width=400)
            else:
                st.info("Please make sure your face is clear.")
                st.image("img/TestFail.png", width=200)





if __name__ == '__main__':
    main()