amitpandey81 commited on
Commit
3dcd679
Β·
verified Β·
1 Parent(s): ca931ec

Upload streamlit_app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. streamlit_app.py +488 -0
streamlit_app.py ADDED
@@ -0,0 +1,488 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import plotly.express as px
4
+ import plotly.graph_objects as go
5
+ from datetime import datetime
6
+ import os
7
+ from utils import load_data, create_project_card, create_impact_metric
8
+
9
+ # Page configuration
10
+ st.set_page_config(
11
+ page_title="Mera Apna Shahar - Building Inclusive Communities",
12
+ page_icon="🏘️",
13
+ layout="wide",
14
+ initial_sidebar_state="expanded"
15
+ )
16
+
17
+ # Custom CSS for better styling
18
+ st.markdown("""
19
+ <style>
20
+ .main-header {
21
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
22
+ padding: 2rem;
23
+ border-radius: 10px;
24
+ margin-bottom: 2rem;
25
+ text-align: center;
26
+ color: white;
27
+ }
28
+ .mission-card {
29
+ background: #f8f9fa;
30
+ padding: 1.5rem;
31
+ border-radius: 10px;
32
+ border-left: 4px solid #667eea;
33
+ margin: 1rem 0;
34
+ }
35
+ .impact-metric {
36
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
37
+ color: white;
38
+ padding: 1rem;
39
+ border-radius: 10px;
40
+ text-align: center;
41
+ margin: 0.5rem;
42
+ }
43
+ .project-card {
44
+ background: white;
45
+ padding: 1.5rem;
46
+ border-radius: 10px;
47
+ box-shadow: 0 2px 10px rgba(0,0,0,0.1);
48
+ margin: 1rem 0;
49
+ border: 1px solid #e0e0e0;
50
+ }
51
+ .stButton > button {
52
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
53
+ color: white;
54
+ border: none;
55
+ padding: 0.75rem 2rem;
56
+ border-radius: 25px;
57
+ font-weight: bold;
58
+ transition: all 0.3s ease;
59
+ }
60
+ .stButton > button:hover {
61
+ transform: translateY(-2px);
62
+ box-shadow: 0 4px 15px rgba(0,0,0,0.2);
63
+ }
64
+ </style>
65
+ """, unsafe_allow_html=True)
66
+
67
+ # Load data
68
+ def load_ngo_data():
69
+ """Load and cache NGO data"""
70
+ projects = {
71
+ 'Discrimination in Society': {
72
+ 'description': 'Fighting against social discrimination and promoting equality for all',
73
+ 'icon': 'βš–οΈ',
74
+ 'activities': [
75
+ 'Anti-discrimination awareness campaigns',
76
+ 'Community dialogue sessions',
77
+ 'Legal aid and support',
78
+ 'Educational workshops',
79
+ 'Social integration programs'
80
+ ],
81
+ 'impact': 1500
82
+ },
83
+ 'Women Environment': {
84
+ 'description': 'Creating safe and empowering spaces for women in urban environments',
85
+ 'icon': 'πŸ‘©',
86
+ 'activities': [
87
+ 'Women safety audits',
88
+ 'Self-defense training',
89
+ 'Safe spaces creation',
90
+ 'Women\'s skill development',
91
+ 'Leadership programs'
92
+ ],
93
+ 'impact': 800
94
+ },
95
+ 'Sustainable Environment': {
96
+ 'description': 'Promoting environmental sustainability and climate action',
97
+ 'icon': '🌱',
98
+ 'activities': [
99
+ 'Tree plantation drives',
100
+ 'Waste management initiatives',
101
+ 'Renewable energy awareness',
102
+ 'Green building campaigns',
103
+ 'Climate education'
104
+ ],
105
+ 'impact': 2500
106
+ },
107
+ 'Cleaner City': {
108
+ 'description': 'Working towards a cleaner, healthier urban environment',
109
+ 'icon': 'πŸ™οΈ',
110
+ 'activities': [
111
+ 'Cleanliness drives',
112
+ 'Plastic waste reduction',
113
+ 'Public space maintenance',
114
+ 'Community cleaning events',
115
+ 'Waste segregation awareness'
116
+ ],
117
+ 'impact': 3200
118
+ }
119
+ }
120
+ return projects
121
+
122
+ # Main header
123
+ st.markdown("""
124
+ <div class="main-header">
125
+ <h1>🏘️ Mera Apna Shahar</h1>
126
+ <h3>Building Inclusive, Sustainable Communities</h3>
127
+ <p>Together we create a better tomorrow for everyone</p>
128
+ </div>
129
+ """, unsafe_allow_html=True)
130
+
131
+ # Header with anycoder credit
132
+ col1, col2, col3 = st.columns([1, 2, 1])
133
+ with col2:
134
+ st.markdown("### Transforming Communities Through Action")
135
+ st.markdown("*Built with [anycoder](https://huggingface.co/spaces/akhaliq/anycoder)*")
136
+
137
+ # Navigation sidebar
138
+ st.sidebar.title("Navigation")
139
+ page = st.sidebar.radio("Go to", ["Home", "About Us", "Our Projects", "Get Involved", "Impact & Success", "Contact"])
140
+
141
+ # Load data
142
+ projects_data = load_ngo_data()
143
+
144
+ if page == "Home":
145
+ # Hero section
146
+ st.markdown("## Welcome to Mera Apna Shahar")
147
+ st.markdown("""
148
+ We are a non-profit organization dedicated to creating positive change in our communities.
149
+ Our mission is to build inclusive, sustainable, and equitable urban environments where every person
150
+ can thrive and contribute to the betterment of society.
151
+ """)
152
+
153
+ # Mission statement
154
+ st.markdown("### Our Mission")
155
+ st.markdown("""
156
+ <div class="mission-card">
157
+ <h4>🌟 Vision Statement</h4>
158
+ <p>To create inclusive, sustainable communities where discrimination has no place,
159
+ women feel safe and empowered, the environment is protected for future generations,
160
+ and our cities are clean, healthy places to live.</p>
161
+ </div>
162
+ """, unsafe_allow_html=True)
163
+
164
+ # Quick stats
165
+ st.markdown("### Our Impact at a Glance")
166
+ col1, col2, col3, col4 = st.columns(4)
167
+
168
+ with col1:
169
+ st.markdown("""
170
+ <div class="impact-metric">
171
+ <h2>8000+</h2>
172
+ <p>People Impacted</p>
173
+ </div>
174
+ """, unsafe_allow_html=True)
175
+
176
+ with col2:
177
+ st.markdown("""
178
+ <div class="impact-metric">
179
+ <h2>150+</h2>
180
+ <p>Projects Completed</p>
181
+ </div>
182
+ """, unsafe_allow_html=True)
183
+
184
+ with col3:
185
+ st.markdown("""
186
+ <div class="impact-metric">
187
+ <h2>50+</h2>
188
+ <p>Active Volunteers</p>
189
+ </div>
190
+ """, unsafe_allow_html=True)
191
+
192
+ with col4:
193
+ st.markdown("""
194
+ <div class="impact-metric">
195
+ <h2>5+</h2>
196
+ <p>Years of Service</p>
197
+ </div>
198
+ """, unsafe_allow_html=True)
199
+
200
+ elif page == "About Us":
201
+ st.markdown("## About Mera Apna Shahar")
202
+
203
+ # Organization story
204
+ st.markdown("### Our Story")
205
+ st.markdown("""
206
+ Founded with a vision of creating inclusive communities, Mera Apna Shahar began as a small grassroots
207
+ initiative addressing the pressing social and environmental challenges in our urban areas.
208
+ What started as community volunteers coming together for local clean-up drives has evolved into
209
+ a comprehensive non-profit organization tackling multiple interconnected issues.
210
+ """)
211
+
212
+ st.markdown("### Our Core Values")
213
+ col1, col2 = st.columns(2)
214
+
215
+ with col1:
216
+ st.markdown("#### 🀝 Inclusivity")
217
+ st.markdown("We believe in creating spaces where everyone feels welcome and valued, regardless of their background, gender, or socioeconomic status.")
218
+
219
+ st.markdown("#### 🌍 Sustainability")
220
+ st.markdown("Environmental protection and sustainable practices are at the heart of everything we do, ensuring a better future for generations to come.")
221
+
222
+ with col2:
223
+ st.markdown("#### πŸ’ͺ Empowerment")
224
+ st.markdown("We focus on empowering communities, especially women and marginalized groups, to take charge of their own development.")
225
+
226
+ st.markdown("#### πŸ”„ Community-Driven")
227
+ st.markdown("Our solutions are developed with and for the community, ensuring they are relevant, sustainable, and locally owned.")
228
+
229
+ # Team section
230
+ st.markdown("### Our Leadership")
231
+ team_data = {
232
+ 'Role': ['Executive Director', 'Program Manager', 'Community Outreach Coordinator', 'Environmental Specialist'],
233
+ 'Name': ['Dr. Priya Sharma', 'Rajesh Kumar', 'Fatima Ali', 'Arjun Patel'],
234
+ 'Experience': ['15+ years', '10+ years', '8+ years', '12+ years']
235
+ }
236
+
237
+ team_df = pd.DataFrame(team_data)
238
+ st.table(team_df)
239
+
240
+ elif page == "Our Projects":
241
+ st.markdown("## Our Project Areas")
242
+ st.markdown("We work on four key areas that are interconnected and essential for building better communities:")
243
+
244
+ # Project cards
245
+ for project_name, project_info in projects_data.items():
246
+ st.markdown(f"""
247
+ <div class="project-card">
248
+ <h3>{project_info['icon']} {project_name}</h3>
249
+ <p>{project_info['description']}</p>
250
+ <h4>Key Activities:</h4>
251
+ <ul>
252
+ """, unsafe_allow_html=True)
253
+
254
+ for activity in project_info['activities']:
255
+ st.markdown(f"<li>{activity}</li>", unsafe_allow_html=True)
256
+
257
+ st.markdown("</ul>", unsafe_allow_html=True)
258
+
259
+ # Show impact metric
260
+ col1, col2 = st.columns([3, 1])
261
+ with col1:
262
+ st.markdown(f"**People directly impacted: {project_info['impact']}+**")
263
+ with col2:
264
+ if st.button(f"Learn More About {project_name}", key=project_name):
265
+ st.info(f"Detailed information about {project_name} projects will be available soon!")
266
+
267
+ st.markdown("</div>", unsafe_allow_html=True)
268
+
269
+ elif page == "Get Involved":
270
+ st.markdown("## Get Involved")
271
+ st.markdown("Join us in making a difference! There are many ways you can contribute to our mission:")
272
+
273
+ tab1, tab2, tab3, tab4 = st.tabs(["🀝 Volunteer", "πŸ’° Donate", "πŸ“’ Partner", "πŸ“§ Contact Us"])
274
+
275
+ with tab1:
276
+ st.markdown("### Become a Volunteer")
277
+ st.markdown("""
278
+ Our volunteers are the backbone of our organization. Whether you can spare a few hours a month
279
+ or want to make a more significant commitment, your contribution makes a real difference.
280
+ """)
281
+
282
+ with st.form("volunteer_form"):
283
+ col1, col2 = st.columns(2)
284
+ with col1:
285
+ name = st.text_input("Full Name")
286
+ email = st.text_input("Email Address")
287
+ phone = st.text_input("Phone Number")
288
+ with col2:
289
+ skills = st.multiselect("Skills/Interests",
290
+ ["Event Organization", "Social Media", "Teaching/Training",
291
+ "Environmental Work", "Community Outreach", "Admin Support"])
292
+ availability = st.selectbox("Availability",
293
+ ["Weekly", "Bi-weekly", "Monthly", "Occasionally", "Project-based"])
294
+
295
+ experience = st.text_area("Tell us about any relevant experience or motivation to volunteer")
296
+
297
+ submitted = st.form_submit_button("Submit Application")
298
+ if submitted:
299
+ st.success("Thank you for your interest in volunteering! We'll contact you soon.")
300
+
301
+ with tab2:
302
+ st.markdown("### Support Our Work")
303
+ st.markdown("""
304
+ Your donations directly support our programs and initiatives. Every contribution,
305
+ no matter the size, helps us create lasting change in communities.
306
+ """)
307
+
308
+ donation_amount = st.selectbox("Choose donation amount",
309
+ ["β‚Ή500", "β‚Ή1,000", "β‚Ή2,500", "β‚Ή5,000", "β‚Ή10,000", "Custom Amount"])
310
+
311
+ if donation_amount == "Custom Amount":
312
+ custom_amount = st.number_input("Enter custom amount (β‚Ή)", min_value=100)
313
+
314
+ donation_purpose = st.selectbox("Direct donation to",
315
+ ["General Fund", "Anti-Discrimination Programs", "Women Empowerment",
316
+ "Environmental Projects", "Clean City Initiatives"])
317
+
318
+ if st.button("Donate Now"):
319
+ st.info("Thank you for your generosity! You will be redirected to our secure payment gateway.")
320
+
321
+ with tab3:
322
+ st.markdown("### Partnership Opportunities")
323
+ st.markdown("""
324
+ We welcome partnerships with like-minded organizations, government agencies,
325
+ and corporate entities who share our vision of creating inclusive communities.
326
+ """)
327
+
328
+ partnership_type = st.selectbox("Partnership Type",
329
+ ["Corporate Social Responsibility", "Government Collaboration",
330
+ "NGO Partnership", "Academic Institution", "Other"])
331
+
332
+ with st.form("partnership_form"):
333
+ organization = st.text_input("Organization Name")
334
+ contact_person = st.text_input("Contact Person")
335
+ partnership_details = st.text_area("Describe potential collaboration areas")
336
+
337
+ submitted = st.form_submit_button("Submit Partnership Inquiry")
338
+ if submitted:
339
+ st.success("Thank you for your interest in partnership! We'll review and respond within 48 hours.")
340
+
341
+ with tab4:
342
+ st.markdown("### Contact Us")
343
+
344
+ contact_info = {
345
+ "πŸ“§ Email": "contact@meraapnashahar.org",
346
+ "πŸ“± Phone": "+91 98765 43210",
347
+ "πŸ“ Address": "123 Community Center, Green Park, New Delhi - 110016",
348
+ "πŸ• Office Hours": "Monday - Friday: 9:00 AM - 6:00 PM"
349
+ }
350
+
351
+ for key, value in contact_info.items():
352
+ st.markdown(f"**{key}** {value}")
353
+
354
+ # Contact form
355
+ with st.form("contact_form"):
356
+ subject = st.selectbox("Subject", ["General Inquiry", "Volunteer Application", "Partnership", "Media Request", "Other"])
357
+ message = st.text_area("Your Message")
358
+
359
+ submitted = st.form_submit_button("Send Message")
360
+ if submitted:
361
+ st.success("Your message has been sent! We'll respond within 24 hours.")
362
+
363
+ elif page == "Impact & Success":
364
+ st.markdown("## Our Impact & Success Stories")
365
+
366
+ # Impact metrics visualization
367
+ st.markdown("### Impact Metrics")
368
+
369
+ # Create impact data
370
+ impact_data = {
371
+ 'Project Area': ['Discrimination in Society', 'Women Environment', 'Sustainable Environment', 'Cleaner City'],
372
+ 'People Impacted': [1500, 800, 2500, 3200],
373
+ 'Projects Completed': [25, 18, 35, 42]
374
+ }
375
+
376
+ fig1 = px.bar(impact_data, x='Project Area', y='People Impacted',
377
+ title='People Impacted by Project Area',
378
+ color='People Impacted', color_continuous_scale='viridis')
379
+ st.plotly_chart(fig1, use_container_width=True)
380
+
381
+ fig2 = px.bar(impact_data, x='Project Area', y='Projects Completed',
382
+ title='Projects Completed by Area',
383
+ color='Projects Completed', color_continuous_scale='plasma')
384
+ st.plotly_chart(fig2, use_container_width=True)
385
+
386
+ # Success stories
387
+ st.markdown("### Success Stories")
388
+
389
+ success_stories = [
390
+ {
391
+ "title": "Community Integration Program Success",
392
+ "description": "Our anti-discrimination initiative in the local community led to the successful integration of 200+ families from diverse backgrounds, fostering mutual understanding and reducing conflicts.",
393
+ "impact": "200+ families integrated",
394
+ "location": "South Delhi Communities"
395
+ },
396
+ {
397
+ "title": "Women's Safety Initiative",
398
+ "description": "Implemented comprehensive safety measures in 5 major residential areas, including improved lighting, emergency response systems, and women's self-defense training programs.",
399
+ "impact": "1,200+ women trained",
400
+ "location": "Multiple residential areas"
401
+ },
402
+ {
403
+ "title": "Green City Transformation",
404
+ "description": "Our environmental sustainability program resulted in the plantation of 5,000+ trees and establishment of 15 community gardens, significantly improving air quality and green cover.",
405
+ "impact": "5,000+ trees planted",
406
+ "location": "City-wide initiative"
407
+ },
408
+ {
409
+ "title": "Clean City Campaign",
410
+ "description": "Monthly cleanliness drives involving 500+ volunteers have transformed 25 public spaces, creating healthier and more attractive community areas.",
411
+ "impact": "25 public spaces transformed",
412
+ "location": "Various city locations"
413
+ }
414
+ ]
415
+
416
+ for i, story in enumerate(success_stories):
417
+ with st.expander(f"πŸ“– {story['title']}"):
418
+ col1, col2 = st.columns([3, 1])
419
+ with col1:
420
+ st.markdown(f"**Impact:** {story['impact']}")
421
+ st.markdown(f"**Location:** {story['location']}")
422
+ st.markdown(story['description'])
423
+ with col2:
424
+ if st.button("Share Story", key=f"share_{i}"):
425
+ st.info("Share functionality will be available soon!")
426
+
427
+ elif page == "Contact":
428
+ st.markdown("## Contact Information")
429
+
430
+ # Contact details
431
+ col1, col2 = st.columns(2)
432
+
433
+ with col1:
434
+ st.markdown("### Get in Touch")
435
+ st.markdown("""
436
+ **πŸ“§ Email:** contact@meraapnashahar.org
437
+
438
+ **πŸ“± Phone:** +91 98765 43210
439
+
440
+ **πŸ“ Address:**
441
+ 123 Community Center
442
+ Green Park, New Delhi - 110016
443
+ India
444
+
445
+ **πŸ• Office Hours:**
446
+ Monday - Friday: 9:00 AM - 6:00 PM
447
+ Saturday: 10:00 AM - 4:00 PM
448
+ Sunday: Closed
449
+ """)
450
+
451
+ with col2:
452
+ st.markdown("### Follow Our Work")
453
+ st.markdown("""
454
+ **πŸ“± Social Media:**
455
+ - Facebook: @MeraApnaShahar
456
+ - Instagram: @meraapnashahar
457
+ - Twitter: @MeraApnaShahar
458
+ - LinkedIn: Mera Apna Shahar Foundation
459
+
460
+ **πŸ“° Newsletter:** Subscribe to our monthly updates
461
+ """)
462
+
463
+ # Newsletter subscription
464
+ with st.form("newsletter_form"):
465
+ email = st.text_input("Email for newsletter")
466
+ interests = st.multiselect("Areas of interest", list(projects_data.keys()))
467
+ subscribe = st.form_submit_button("Subscribe")
468
+ if subscribe:
469
+ st.success("Thank you for subscribing to our newsletter!")
470
+
471
+ # Map placeholder
472
+ st.markdown("### Our Location")
473
+ st.info("Interactive map will be available soon. We are located in Green Park, New Delhi.")
474
+
475
+ # Emergency contact
476
+ st.markdown("### Emergency Contact")
477
+ st.warning("**For urgent matters outside office hours:** +91 98765 43210")
478
+
479
+ # Footer
480
+ st.markdown("---")
481
+ st.markdown("""
482
+ <div style="text-align: center; padding: 2rem; background: #f8f9fa; border-radius: 10px; margin-top: 2rem;">
483
+ <h4>🌟 Mera Apna Shahar - Building Inclusive Communities Together</h4>
484
+ <p>Together we create a better tomorrow for everyone</p>
485
+ <p><small>Β© 2024 Mera Apna Shahar. All rights reserved. |
486
+ <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank">Built with anycoder</a></small></p>
487
+ </div>
488
+ """, unsafe_allow_html=True)