ibrahim321123 commited on
Commit
3666b5f
·
verified ·
1 Parent(s): 5113b98

Create 5_Masjid_Finder.py

Browse files
Files changed (1) hide show
  1. pages/5_Masjid_Finder.py +35 -0
pages/5_Masjid_Finder.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import json
3
+ from fuzzywuzzy import process
4
+
5
+ st.title("🕌 Shaafee - Masjid Finder (Pakistan)")
6
+
7
+ st.write(
8
+ "Find nearby Masajid in your city and area. Just type your city and area name!"
9
+ )
10
+
11
+ # Load masjid data from JSON
12
+ with open("masjid_data.json", "r", encoding="utf-8") as f:
13
+ masjid_data = json.load(f)
14
+
15
+ # Input city and area
16
+ city = st.text_input("Enter your city (e.g., Lahore, Karachi, Islamabad):").strip().lower()
17
+ area = st.text_input("Enter your area/neighbourhood:").strip().lower()
18
+
19
+ if st.button("Find Masajid"):
20
+ if city in masjid_data:
21
+ possible_areas = list(masjid_data[city].keys())
22
+ match, score = process.extractOne(area, possible_areas)
23
+
24
+ if score >= 70:
25
+ st.success(f"📍 Masajid near **{match.title()}**, {city.title()}:")
26
+ for masjid in masjid_data[city][match]:
27
+ st.write(f"- {masjid}")
28
+ else:
29
+ st.warning(
30
+ "⚠ No close match found for this area. Try a nearby name or check spelling."
31
+ )
32
+ else:
33
+ st.warning(
34
+ "⚠ City not found. Please check your spelling or try a supported city."
35
+ )