Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -26,6 +26,7 @@ priority_area = st.sidebar.selectbox("Priority Area:", ["Rural", "Urban", "Subur
|
|
| 26 |
signal_threshold = st.sidebar.slider("Signal Strength Threshold (dBm):", min_value=-120, max_value=-30, value=-80)
|
| 27 |
terrain_weight = st.sidebar.slider("Terrain Difficulty Weight:", min_value=0.0, max_value=1.0, value=0.5)
|
| 28 |
cost_weight = st.sidebar.slider("Cost Weight:", min_value=0.0, max_value=1.0, value=0.5)
|
|
|
|
| 29 |
|
| 30 |
# Display Dataset Options
|
| 31 |
data_to_view = st.sidebar.selectbox("Select Dataset to View:", ["Network Insights", "Filtered Terrain Data"])
|
|
@@ -43,7 +44,19 @@ def generate_terrain_data():
|
|
| 43 |
"Terrain Difficulty (0-10)": np.random.randint(1, 10, size=10),
|
| 44 |
"Signal Strength (dBm)": np.random.randint(-120, -30, size=10),
|
| 45 |
"Cost ($1000s)": np.random.randint(50, 200, size=10),
|
| 46 |
-
"Priority Area": np.random.choice(["Rural", "Urban", "Suburban"], size=10)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
}
|
| 48 |
return pd.DataFrame(data)
|
| 49 |
|
|
@@ -69,7 +82,9 @@ if data_to_view == "Network Insights":
|
|
| 69 |
st.dataframe(network_insights)
|
| 70 |
elif data_to_view == "Filtered Terrain Data":
|
| 71 |
st.subheader("Filtered Terrain Data")
|
| 72 |
-
st.dataframe(filtered_data
|
|
|
|
|
|
|
| 73 |
|
| 74 |
# Map Visualization
|
| 75 |
st.header("Geographical Map of Regions")
|
|
@@ -82,10 +97,12 @@ if not filtered_data.empty:
|
|
| 82 |
location=[row["Latitude"], row["Longitude"]],
|
| 83 |
popup=(
|
| 84 |
f"<b>Region:</b> {row['Region']}<br>"
|
|
|
|
| 85 |
f"<b>Signal Strength:</b> {row['Signal Strength (dBm)']} dBm<br>"
|
| 86 |
f"<b>Cost:</b> ${row['Cost ($1000s)']}k<br>"
|
| 87 |
f"<b>Terrain Difficulty:</b> {row['Terrain Difficulty (0-10)']}"
|
| 88 |
),
|
|
|
|
| 89 |
).add_to(region_map)
|
| 90 |
|
| 91 |
st_folium(region_map, width=700, height=500)
|
|
@@ -114,7 +131,7 @@ def recommend_deployment(data):
|
|
| 114 |
if data.empty:
|
| 115 |
return "No viable deployment regions within the specified parameters."
|
| 116 |
best_region = data.loc[data["Composite Score"].idxmax()]
|
| 117 |
-
return f"Recommended Region: {best_region['Region']} with Composite Score: {best_region['Composite Score']:.2f}, Signal Strength: {best_region['Signal Strength (dBm)']} dBm, Terrain Difficulty: {best_region['Terrain Difficulty (0-10)']}, and Estimated Cost: ${best_region['Cost ($1000s)']}k"
|
| 118 |
|
| 119 |
recommendation = recommend_deployment(filtered_data)
|
| 120 |
st.subheader(recommendation)
|
|
|
|
| 26 |
signal_threshold = st.sidebar.slider("Signal Strength Threshold (dBm):", min_value=-120, max_value=-30, value=-80)
|
| 27 |
terrain_weight = st.sidebar.slider("Terrain Difficulty Weight:", min_value=0.0, max_value=1.0, value=0.5)
|
| 28 |
cost_weight = st.sidebar.slider("Cost Weight:", min_value=0.0, max_value=1.0, value=0.5)
|
| 29 |
+
include_human_readable = st.sidebar.checkbox("Include Human-Readable Info", value=True)
|
| 30 |
|
| 31 |
# Display Dataset Options
|
| 32 |
data_to_view = st.sidebar.selectbox("Select Dataset to View:", ["Network Insights", "Filtered Terrain Data"])
|
|
|
|
| 44 |
"Terrain Difficulty (0-10)": np.random.randint(1, 10, size=10),
|
| 45 |
"Signal Strength (dBm)": np.random.randint(-120, -30, size=10),
|
| 46 |
"Cost ($1000s)": np.random.randint(50, 200, size=10),
|
| 47 |
+
"Priority Area": np.random.choice(["Rural", "Urban", "Suburban"], size=10),
|
| 48 |
+
"Description": [
|
| 49 |
+
"Flat area with minimal obstacles",
|
| 50 |
+
"Hilly terrain, moderate construction difficulty",
|
| 51 |
+
"Dense urban area with high costs",
|
| 52 |
+
"Suburban area, balanced terrain",
|
| 53 |
+
"Mountainous region, challenging setup",
|
| 54 |
+
"Remote rural area, sparse population",
|
| 55 |
+
"Coastal area, potential for high signal interference",
|
| 56 |
+
"Industrial zone, requires robust infrastructure",
|
| 57 |
+
"Dense forest region, significant signal attenuation",
|
| 58 |
+
"Open plains, optimal for cost-effective deployment"
|
| 59 |
+
]
|
| 60 |
}
|
| 61 |
return pd.DataFrame(data)
|
| 62 |
|
|
|
|
| 82 |
st.dataframe(network_insights)
|
| 83 |
elif data_to_view == "Filtered Terrain Data":
|
| 84 |
st.subheader("Filtered Terrain Data")
|
| 85 |
+
st.dataframe(filtered_data[[
|
| 86 |
+
"Region", "Priority Area", "Signal Strength (dBm)", "Cost ($1000s)", "Terrain Difficulty (0-10)", "Description", "Composite Score"
|
| 87 |
+
]])
|
| 88 |
|
| 89 |
# Map Visualization
|
| 90 |
st.header("Geographical Map of Regions")
|
|
|
|
| 97 |
location=[row["Latitude"], row["Longitude"]],
|
| 98 |
popup=(
|
| 99 |
f"<b>Region:</b> {row['Region']}<br>"
|
| 100 |
+
f"<b>Description:</b> {row['Description']}<br>"
|
| 101 |
f"<b>Signal Strength:</b> {row['Signal Strength (dBm)']} dBm<br>"
|
| 102 |
f"<b>Cost:</b> ${row['Cost ($1000s)']}k<br>"
|
| 103 |
f"<b>Terrain Difficulty:</b> {row['Terrain Difficulty (0-10)']}"
|
| 104 |
),
|
| 105 |
+
icon=folium.Icon(color="blue", icon="info-sign")
|
| 106 |
).add_to(region_map)
|
| 107 |
|
| 108 |
st_folium(region_map, width=700, height=500)
|
|
|
|
| 131 |
if data.empty:
|
| 132 |
return "No viable deployment regions within the specified parameters."
|
| 133 |
best_region = data.loc[data["Composite Score"].idxmax()]
|
| 134 |
+
return f"Recommended Region: {best_region['Region']} with Composite Score: {best_region['Composite Score']:.2f}, Signal Strength: {best_region['Signal Strength (dBm)']} dBm, Terrain Difficulty: {best_region['Terrain Difficulty (0-10)']}, and Estimated Cost: ${best_region['Cost ($1000s)']}k\nDescription: {best_region['Description']}"
|
| 135 |
|
| 136 |
recommendation = recommend_deployment(filtered_data)
|
| 137 |
st.subheader(recommendation)
|