Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,8 @@ import numpy as np
|
|
4 |
import plotly.express as px
|
5 |
from transformers import pipeline
|
6 |
from datasets import load_dataset
|
|
|
|
|
7 |
|
8 |
# Hugging Face Datasets
|
9 |
@st.cache_data
|
@@ -36,6 +38,8 @@ def generate_terrain_data():
|
|
36 |
np.random.seed(42)
|
37 |
data = {
|
38 |
"Region": [f"Region-{i}" for i in range(1, 11)],
|
|
|
|
|
39 |
"Terrain Difficulty (0-10)": np.random.randint(1, 10, size=10),
|
40 |
"Signal Strength (dBm)": np.random.randint(-120, -30, size=10),
|
41 |
"Cost ($1000s)": np.random.randint(50, 200, size=10),
|
@@ -67,6 +71,27 @@ elif data_to_view == "Filtered Terrain Data":
|
|
67 |
st.subheader("Filtered Terrain Data")
|
68 |
st.dataframe(filtered_data)
|
69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
# Visualization
|
71 |
fig = px.scatter(
|
72 |
filtered_data,
|
|
|
4 |
import plotly.express as px
|
5 |
from transformers import pipeline
|
6 |
from datasets import load_dataset
|
7 |
+
import folium
|
8 |
+
from streamlit_folium import st_folium
|
9 |
|
10 |
# Hugging Face Datasets
|
11 |
@st.cache_data
|
|
|
38 |
np.random.seed(42)
|
39 |
data = {
|
40 |
"Region": [f"Region-{i}" for i in range(1, 11)],
|
41 |
+
"Latitude": np.random.uniform(30.0, 50.0, size=10),
|
42 |
+
"Longitude": np.random.uniform(-120.0, -70.0, size=10),
|
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),
|
|
|
71 |
st.subheader("Filtered Terrain Data")
|
72 |
st.dataframe(filtered_data)
|
73 |
|
74 |
+
# Map Visualization
|
75 |
+
st.header("Geographical Map of Regions")
|
76 |
+
if not filtered_data.empty:
|
77 |
+
map_center = [filtered_data["Latitude"].mean(), filtered_data["Longitude"].mean()]
|
78 |
+
region_map = folium.Map(location=map_center, zoom_start=6)
|
79 |
+
|
80 |
+
for _, row in filtered_data.iterrows():
|
81 |
+
folium.Marker(
|
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)
|
92 |
+
else:
|
93 |
+
st.write("No regions match the selected criteria.")
|
94 |
+
|
95 |
# Visualization
|
96 |
fig = px.scatter(
|
97 |
filtered_data,
|