Spaces:
Sleeping
Sleeping
Update app.py
Browse files7 unmodified lines891011121314148 unmodified lines163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216162 unmodified lines3793803813823833843857 unmodified lines# 1. PAGE CONFIGURATIONst.set_page_config(page_title="S.T.A.R.K AI | UIDAI Fraud Detection",page_icon="",layout="wide",initial_sidebar_state="expanded")148 unmodified lines'West Bengal': (22.9868, 87.8550)}def get_coords(row):state = row.get('state', 'Delhi')district = str(row.get('district', 'Unknown'))# 1. Get State Base Coordinates (Use your updated list)base_lat, base_lon = state_centers.get(state, (20.5937, 78.9629))# 2. DEFINE STATE RADIUS SCALER (In Degrees)# Default is 0.5 (~55km) which is safer than 1.5default_radius = 0.5# Tighter constraints for small States/UTsradius_map = {'Chandigarh': 0.04,'Delhi': 0.15,'Goa': 0.15,'Puducherry': 0.1,'Lakshadweep': 0.05,'Daman and Diu': 0.05,'Dadra and Nagar Haveli': 0.05,'Kerala': 0.3, # Narrow state'Haryana': 0.4,'Punjab': 0.4,'Tripura': 0.3,'Sikkim': 0.15,'Andaman and Nicobar Islands': 1.0 # Long archipelago}# Get the specific radius for this stateradius = radius_map.get(state, default_radius)# 3. DETERMINISTIC HASHINGdistrict_hash = hash(state + district)np.random.seed(district_hash % 2**32)# Offset using the specific radiusdist_lat_offset = np.random.uniform(-radius, radius)dist_lon_offset = np.random.uniform(-radius, radius)# 4. MICRO JITTER (Random noise for individual points)np.random.seed(None)noise_lat = np.random.normal(0, 0.02 * radius) # Scale noise relative to state sizenoise_lon = np.random.normal(0, 0.02 * radius)return pd.Series({'lat': base_lat + dist_lat_offset + noise_lat,'lon': base_lon + dist_lon_offset + noise_lon})# Apply coordinatescoords = df.apply(get_coords, axis=1)162 unmodified linesst.download_button("Download CSV",data=csv,file_name="uidai_S.T.A.R.K AI_priority_list.csv",mime="text/csv",type="primary")7 unmodified lines891011121314148 unmodified lines163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216162 unmodified lines3793803813823833843857 unmodified lines# 1. PAGE CONFIGURATIONst.set_page_config(page_title="S.T.A.R.K AI | UIDAI Fraud Detection",page_icon="🛡️",layout="wide",initial_sidebar_state="expanded")148 unmodified lines'West Bengal': (22.9868, 87.8550)}def get_coords(row):state = row.get('state', 'Delhi')district = str(row.get('district', 'Unknown'))# 1. Get State Base Coordinates (Use your updated list)base_lat, base_lon = state_centers.get(state, (20.5937, 78.9629))# 2. DEFINE STATE RADIUS SCALER (In Degrees)# Default is 0.5 (~55km) which is safer than 1.5default_radius = 0.5# Tighter constraints for small States/UTsradius_map = {'Chandigarh': 0.04,'Delhi': 0.15,'Goa': 0.15,'Puducherry': 0.1,'Lakshadweep': 0.05,'Daman and Diu': 0.05,'Dadra and Nagar Haveli': 0.05,'Kerala': 0.3, # Narrow state'Haryana': 0.4,'Punjab': 0.4,'Tripura': 0.3,'Sikkim': 0.15,'Andaman and Nicobar Islands': 1.0 # Long archipelago}# Get the specific radius for this stateradius = radius_map.get(state, default_radius)# 3. DETERMINISTIC HASHINGdistrict_hash = hash(state + district)np.random.seed(district_hash % 2**32)# Offset using the specific radiusdist_lat_offset = np.random.uniform(-radius, radius)dist_lon_offset = np.random.uniform(-radius, radius)# 4. MICRO JITTER (Random noise for individual points)np.random.seed(None)noise_lat = np.random.normal(0, 0.02 * radius) # Scale noise relative to state sizenoise_lon = np.random.normal(0, 0.02 * radius)return pd.Series({'lat': base_lat + dist_lat_offset + noise_lat,'lon': base_lon + dist_lon_offset + noise_lon})# Apply coordinatescoords = df.apply(get_coords, axis=1)162 unmodified linesst.download_button("Download CSV",data=csv,file_name="uidai_stark_ai_priority_list.csv",mime="text/csv",type="primary")
app.py+50-50