File size: 9,115 Bytes
8b90525
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195


import streamlit as st
from streamlit_option_menu import option_menu
from car_damage_detection import car_damage_detection_page
from utils import fetch_car_data
from admin_portal import admin_portal

# Set the page config
st.set_page_config(page_title="Automobile Damage Detection", layout="wide")

# Check for admin page in query paramss
query_params = st.query_params
if 'admin' in query_params:
    admin_portal()
else:
    # Sidebar for navigation using option_menu
    with st.sidebar:
        st.markdown("<h1 style='text-align: center;'>Welcome User</h1>", unsafe_allow_html=True)
        page = option_menu(
            "Navigation", 
            ["Home", "Car Damage Detection", "Contact Us"],
            icons=["house", "search", "envelope"],
            menu_icon="cast",
            default_index=0,
        )
        st.success("Welcome to the Automobile Damage Detection Website. Verify car authenticity, upload damaged car images, detect damages, get repair cost estimates, and download detailed PDF reports.")
        st.info("Currently logged in as User")


    # Home Page
    if page == "Home":
        st.image('banner.jpg', use_column_width=True)
        st.markdown("***")
        st.markdown("<h2 style='text-align: center;'>Project Information</h2>", unsafe_allow_html=True)
        st.markdown("***")
        st.markdown("""
        ## Welcome to the Automobile Damage Detection App!
        This app offers a variety of features to help you manage and assess car damages effectively. Below are the key functionalities:

        ### Car Damage Detection
        - **Authenticity Check**: Verifies car details in our database to prevent frauds.
        - **Damage Detection**: If the car data matches, upload an image of the damaged car. The system will detect the damaged parts and provide an estimated repair cost.
        - **PDF Report**: Download a detailed PDF report containing the predicted image, car details, damaged parts, and the total estimated cost.

        ### Dashboard
        - **Performance Monitoring**: Monitor the application's performance and manage car data efficiently.
        - **Data Insights**: Gain insights into the types of damages, frequency, and repair costs.

        ### Contact Us
        - **Support**: Reach out to the developer or project owner for support or inquiries.
        - **Feedback**: Provide feedback to help us improve the application.

        To get started, navigate to the **Car Damage Detection** page and upload a car image for an instant damage assessment.
        """)
        
        st.markdown("***")
        
        st.header("How It Works")
        st.markdown("""
        1. **Authenticate Car**: Enter the car details to verify authenticity.
        2. **Upload Image**: Upload an image of the damaged car.
        3. **Detect Damage**: The system analyzes the image and identifies the damaged parts.
        4. **Estimate Cost**: Get an estimated repair cost based on the detected damages.
        5. **Download Report**: Download a PDF report with all the details.
        """)
        
        st.markdown("***")
        
        st.header("Features")
        st.markdown("""
        - **Accurate Damage Detection**: Uses advanced image processing and machine learning to detect damages accurately.
        - **Fraud Prevention**: Ensures car details are verified before processing.
        - **User-Friendly Interface**: Easy-to-use interface for a seamless experience.
        - **Detailed Reports**: Provides comprehensive reports for better understanding and transparency.
        """)
        
        st.markdown("***")
        
        # st.header("Notes")
        st.warning("Please note that the accuracy of the model is based on the dataset available during model training. For real-world predictions, the accuracy may vary.")
        st.success("For more information, visit the [Automobile Damage Detection App](https://automobile-damage-detection.streamlit.app).")

    # Car Damage Detection Page
    elif page == "Car Damage Detection":
        st.markdown("<h1 style='text-align: center;'>Automobile Damage Detection</h1>", unsafe_allow_html=True)
        st.markdown("***")

        st.header("Steps to Detect Car Damages and Estimate Repair Cost")
        st.markdown("""
        Welcome to the Car Damage Detection page. Follow the steps below to detect damages in your car and get an estimated repair cost:

        1. **Enter Car Registration Number**: Verify the car's authenticity by entering the car registration number. This helps prevent fraud.
        2. **Fetch Car Data**: Click the button to fetch car details from the database.
        3. **Upload Damaged Car Image**: If the car data is verified, upload an image of the damaged car.
        4. **Detect Damages**: The system will analyze the image to identify damaged parts.
        5. **Get Repair Cost Estimate**: Receive an estimated repair cost based on the detected damages.
        6. **Download Report**: Download a detailed PDF report with the car details, damage detection results, and estimated repair cost.
        """)
        st.markdown("***")

        car_damage_detection_page()


    # Contact Us Page
    elif page == "Contact Us":
        st.markdown("<h1 style='text-align: center;'>Automobile Damage Detection</h1>", unsafe_allow_html=True)
        st.markdown("***")
        st.header("Contact Us")
        st.write("Please fill out the form below to get in touch with me.")
        name = st.text_input("Your Name")
        email = st.text_input("Your Email")
        message = st.text_area("Message", height=150)

        if st.button("Submit"):
            if name.strip() == "" or email.strip() == "" or message.strip() == "":
                st.warning("Please fill out all the fields.")
            else:
                send_email_to = 'kumawatharsh2004@gmail.com'
                st.success("Your message has been sent successfully!")






# elif page == "Contact Us":
    #     st.markdown("***")
    #     st.header("Our Team")
    #     row1 = st.columns(3)

    #     # Data for team members
    #     team_members = [
    #         {"name": "Harsh Kumawat (9922102118)", "image": "1.jpeg", "linkedin": "https://www.linkedin.com/in/alice-smith"},
    #         {"name": "Anmol Dhuwalia (9922102109)", "image": "1.jpeg", "linkedin": "https://www.linkedin.com/in/bob-johnson"},
    #         {"name": "Athatva Goel (9922102097)", "image": "1.jpeg", "linkedin": "https://www.linkedin.com/in/carol-white"}
    #     ]

    #     # Iterate over the columns and add team member details
    #     for col, member in zip(row1, team_members):
    #         with col:
    #             st.image(member["image"], use_column_width=True)
    #             st.markdown(f"<h3 style='text-align: center;'>{member['name']}</h3>", unsafe_allow_html=True)
    #             st.markdown(
    #                 f"<p style='text-align: center;'><a href='{member['linkedin']}' target='_blank'>"
    #                 f"<img src='https://image.flaticon.com/icons/png/512/174/174857.png' width='24'></a></p>",
    #                 unsafe_allow_html=True
    #             )

    #     st.markdown("***")
    #     st.header("Contact Me")
    #     st.write("Please fill out the form below to get in touch with me.")

    #     # Input fields for user's name, email, and message
    #     name = st.text_input("Your Name")
    #     email = st.text_input("Your Email")
    #     message = st.text_area("Message", height=150)

    #     # Submit button
    #     if st.button("Submit"):
    #         if name.strip() == "" or email.strip() == "" or message.strip() == "":
    #             st.warning("Please fill out all the fields.")
    #         else:
    #             send_email_to = 'kumawatharsh2004@gmail.com'
    #             st.success("Your message has been sent successfully!")




    # Admin Login Sections
    admin_button_placeholder = st.empty()
    with admin_button_placeholder.container():
        if not st.session_state.get('admin_authenticated', False):
            if st.sidebar.button("Admin Login", key="admin_login_button"):
                st.session_state['show_admin_login'] = True
            
            if st.session_state.get('show_admin_login', False):
                with st.sidebar.form("login_form"):
                    st.write("Admin Login")
                    username = st.text_input("Username")
                    password = st.text_input("Password", type="password")
                    login_button = st.form_submit_button("Login")

                    if login_button:
                        if username == "admin" and password == "password":  
                            st.session_state['admin_authenticated'] = True
                            st.session_state['show_admin_login'] = False
                            st.success("Login successful")
                            
                            st.query_params.admin = "true"
                        else:
                            st.error("Invalid credentials")
        else:
            admin_portal()