Spaces:
Sleeping
Sleeping
Update app.py
#1
by
amanchoudhary2112
- opened
app.py
CHANGED
|
@@ -7,8 +7,8 @@ from datetime import datetime
|
|
| 7 |
|
| 8 |
# 1. PAGE CONFIGURATION
|
| 9 |
st.set_page_config(
|
| 10 |
-
page_title="
|
| 11 |
-
page_icon="
|
| 12 |
layout="wide",
|
| 13 |
initial_sidebar_state="expanded"
|
| 14 |
)
|
|
@@ -211,12 +211,12 @@ df = load_data()
|
|
| 211 |
|
| 212 |
# 4. SIDEBAR & FILTERS
|
| 213 |
with st.sidebar:
|
| 214 |
-
st.markdown("###
|
| 215 |
st.markdown("---")
|
| 216 |
|
| 217 |
# State Filter
|
| 218 |
state_list = ['All'] + sorted(df['state'].unique().tolist())
|
| 219 |
-
selected_state = st.selectbox("
|
| 220 |
|
| 221 |
# District Filter
|
| 222 |
if selected_state != 'All':
|
|
@@ -226,7 +226,7 @@ with st.sidebar:
|
|
| 226 |
filtered_df = df.copy()
|
| 227 |
district_list = ['All']
|
| 228 |
|
| 229 |
-
selected_district = st.selectbox("
|
| 230 |
|
| 231 |
if selected_district != 'All':
|
| 232 |
filtered_df = filtered_df[filtered_df['district'] == selected_district]
|
|
@@ -235,7 +235,7 @@ with st.sidebar:
|
|
| 235 |
|
| 236 |
# Risk Filter
|
| 237 |
risk_filter = st.multiselect(
|
| 238 |
-
"
|
| 239 |
options=['Low', 'Medium', 'High', 'Critical'],
|
| 240 |
default=['High', 'Critical']
|
| 241 |
)
|
|
@@ -247,7 +247,7 @@ with st.sidebar:
|
|
| 247 |
|
| 248 |
# Links
|
| 249 |
st.markdown("**Resources**")
|
| 250 |
-
st.link_button("
|
| 251 |
|
| 252 |
st.markdown("---")
|
| 253 |
st.info(f"**User:** UIDAI_Officer\n\n**Team:** UIDAI_4571")
|
|
@@ -255,13 +255,13 @@ with st.sidebar:
|
|
| 255 |
# 5. HEADER & KPI METRICS
|
| 256 |
col1, col2 = st.columns([3, 1])
|
| 257 |
with col1:
|
| 258 |
-
st.title("Project
|
| 259 |
st.markdown("Context-Aware Fraud Detection System")
|
| 260 |
|
| 261 |
with col2:
|
| 262 |
st.markdown("""
|
| 263 |
<div style="text-align: right; padding-top: 20px;">
|
| 264 |
-
<span class="status-badge bg-green"
|
| 265 |
<div style="font-size: 12px; color: #64748b; margin-top: 5px;">Live Monitor</div>
|
| 266 |
</div>
|
| 267 |
""", unsafe_allow_html=True)
|
|
@@ -283,7 +283,7 @@ m4.metric("Weekend Spikes", f"{weekend_alerts}", "Unauthorized", delta_color="of
|
|
| 283 |
st.markdown("##") # Spacer
|
| 284 |
|
| 285 |
# 6. MAIN TABS
|
| 286 |
-
tab_map, tab_list, tab_charts = st.tabs(["
|
| 287 |
|
| 288 |
# TAB 1: GEOGRAPHIC RISK (MAP)
|
| 289 |
with tab_map:
|
|
@@ -357,9 +357,9 @@ with tab_list:
|
|
| 357 |
# Export Button
|
| 358 |
csv = target_list.to_csv(index=False).encode('utf-8')
|
| 359 |
st.download_button(
|
| 360 |
-
"
|
| 361 |
data=csv,
|
| 362 |
-
file_name="
|
| 363 |
mime="text/csv",
|
| 364 |
type="primary"
|
| 365 |
)
|
|
@@ -401,7 +401,7 @@ with tab_charts:
|
|
| 401 |
st.markdown("---")
|
| 402 |
st.markdown("""
|
| 403 |
<div style="text-align: center; font-size: 13px; color: #94a3b8;">
|
| 404 |
-
<b>Project
|
| 405 |
<i>Confidential - For Official Use Only</i>
|
| 406 |
</div>
|
| 407 |
""", unsafe_allow_html=True)
|
|
|
|
| 7 |
|
| 8 |
# 1. PAGE CONFIGURATION
|
| 9 |
st.set_page_config(
|
| 10 |
+
page_title="S.T.A.R.K AI | UIDAI Fraud Detection",
|
| 11 |
+
page_icon="",
|
| 12 |
layout="wide",
|
| 13 |
initial_sidebar_state="expanded"
|
| 14 |
)
|
|
|
|
| 211 |
|
| 212 |
# 4. SIDEBAR & FILTERS
|
| 213 |
with st.sidebar:
|
| 214 |
+
st.markdown("### S.T.A.R.K AI Control")
|
| 215 |
st.markdown("---")
|
| 216 |
|
| 217 |
# State Filter
|
| 218 |
state_list = ['All'] + sorted(df['state'].unique().tolist())
|
| 219 |
+
selected_state = st.selectbox("Select State", state_list)
|
| 220 |
|
| 221 |
# District Filter
|
| 222 |
if selected_state != 'All':
|
|
|
|
| 226 |
filtered_df = df.copy()
|
| 227 |
district_list = ['All']
|
| 228 |
|
| 229 |
+
selected_district = st.selectbox("Select District", district_list)
|
| 230 |
|
| 231 |
if selected_district != 'All':
|
| 232 |
filtered_df = filtered_df[filtered_df['district'] == selected_district]
|
|
|
|
| 235 |
|
| 236 |
# Risk Filter
|
| 237 |
risk_filter = st.multiselect(
|
| 238 |
+
"Risk Level",
|
| 239 |
options=['Low', 'Medium', 'High', 'Critical'],
|
| 240 |
default=['High', 'Critical']
|
| 241 |
)
|
|
|
|
| 247 |
|
| 248 |
# Links
|
| 249 |
st.markdown("**Resources**")
|
| 250 |
+
st.link_button("Open Notebook in Colab", "https://colab.research.google.com/drive/1YAQ4nfxltvG_cts3fmGc_zi2JQc4oPOT?usp=sharing")
|
| 251 |
|
| 252 |
st.markdown("---")
|
| 253 |
st.info(f"**User:** UIDAI_Officer\n\n**Team:** UIDAI_4571")
|
|
|
|
| 255 |
# 5. HEADER & KPI METRICS
|
| 256 |
col1, col2 = st.columns([3, 1])
|
| 257 |
with col1:
|
| 258 |
+
st.title("Project S.T.A.R.K AI Dashboard")
|
| 259 |
st.markdown("Context-Aware Fraud Detection System")
|
| 260 |
|
| 261 |
with col2:
|
| 262 |
st.markdown("""
|
| 263 |
<div style="text-align: right; padding-top: 20px;">
|
| 264 |
+
<span class="status-badge bg-green">System Online</span>
|
| 265 |
<div style="font-size: 12px; color: #64748b; margin-top: 5px;">Live Monitor</div>
|
| 266 |
</div>
|
| 267 |
""", unsafe_allow_html=True)
|
|
|
|
| 283 |
st.markdown("##") # Spacer
|
| 284 |
|
| 285 |
# 6. MAIN TABS
|
| 286 |
+
tab_map, tab_list, tab_charts = st.tabs(["Geographic Risk", "Priority List", "Pattern Analytics"])
|
| 287 |
|
| 288 |
# TAB 1: GEOGRAPHIC RISK (MAP)
|
| 289 |
with tab_map:
|
|
|
|
| 357 |
# Export Button
|
| 358 |
csv = target_list.to_csv(index=False).encode('utf-8')
|
| 359 |
st.download_button(
|
| 360 |
+
"Download CSV",
|
| 361 |
data=csv,
|
| 362 |
+
file_name="uidai_S.T.A.R.K AI_priority_list.csv",
|
| 363 |
mime="text/csv",
|
| 364 |
type="primary"
|
| 365 |
)
|
|
|
|
| 401 |
st.markdown("---")
|
| 402 |
st.markdown("""
|
| 403 |
<div style="text-align: center; font-size: 13px; color: #94a3b8;">
|
| 404 |
+
<b>Project S.T.A.R.K AI</b> | UIDAI Hackathon 2026 | Team UIDAI_4571<br>
|
| 405 |
<i>Confidential - For Official Use Only</i>
|
| 406 |
</div>
|
| 407 |
""", unsafe_allow_html=True)
|