Spaces:
Sleeping
Sleeping
Commit
·
890c31a
1
Parent(s):
dbf2566
Interface changes
Browse files- main.py +1 -1
- mapbox_map.py +7 -4
main.py
CHANGED
|
@@ -85,7 +85,7 @@ if images and result:
|
|
| 85 |
|
| 86 |
# Request descriptions and coordinates from Wikipedia.
|
| 87 |
wiki_data = getWikipedia(names)
|
| 88 |
-
|
| 89 |
# Summarize descriptions for each landmark.
|
| 90 |
if summarize_checkbox:
|
| 91 |
for landmark in wiki_data:
|
|
|
|
| 85 |
|
| 86 |
# Request descriptions and coordinates from Wikipedia.
|
| 87 |
wiki_data = getWikipedia(names)
|
| 88 |
+
|
| 89 |
# Summarize descriptions for each landmark.
|
| 90 |
if summarize_checkbox:
|
| 91 |
for landmark in wiki_data:
|
mapbox_map.py
CHANGED
|
@@ -16,22 +16,25 @@ def plot_map(landmarks):
|
|
| 16 |
# Загрузка данных
|
| 17 |
data = pd.DataFrame(landmarks)
|
| 18 |
data = preprocess_df(data)
|
| 19 |
-
|
| 20 |
# Создание маркеров
|
| 21 |
marker_size = 12 # Размер маркера
|
| 22 |
|
| 23 |
fig = go.Figure()
|
| 24 |
|
|
|
|
|
|
|
| 25 |
for i, row in data.iterrows():
|
| 26 |
if type(row['latitude']) is not float:
|
| 27 |
continue
|
| 28 |
fig.add_trace(go.Scattermapbox(
|
|
|
|
| 29 |
lat=[row['latitude']],
|
| 30 |
lon=[row['longitude']],
|
| 31 |
mode='markers',
|
| 32 |
marker=dict(
|
| 33 |
size=marker_size,
|
| 34 |
-
color=
|
| 35 |
sizemode='diameter', # Размер маркера в диаметрах
|
| 36 |
),
|
| 37 |
text=row['find']
|
|
@@ -48,7 +51,7 @@ def plot_map(landmarks):
|
|
| 48 |
|
| 49 |
# Настройка карты
|
| 50 |
fig.update_layout(
|
| 51 |
-
mapbox_style="
|
| 52 |
mapbox=dict(
|
| 53 |
center=dict(lat=center_lat, lon=center_lon),
|
| 54 |
zoom=zoom_level,
|
|
@@ -56,4 +59,4 @@ def plot_map(landmarks):
|
|
| 56 |
)
|
| 57 |
|
| 58 |
# Отображение карты в Streamlit
|
| 59 |
-
st.plotly_chart(fig)
|
|
|
|
| 16 |
# Загрузка данных
|
| 17 |
data = pd.DataFrame(landmarks)
|
| 18 |
data = preprocess_df(data)
|
| 19 |
+
|
| 20 |
# Создание маркеров
|
| 21 |
marker_size = 12 # Размер маркера
|
| 22 |
|
| 23 |
fig = go.Figure()
|
| 24 |
|
| 25 |
+
marker_colors = ['orange', 'purple', 'red', 'green']
|
| 26 |
+
|
| 27 |
for i, row in data.iterrows():
|
| 28 |
if type(row['latitude']) is not float:
|
| 29 |
continue
|
| 30 |
fig.add_trace(go.Scattermapbox(
|
| 31 |
+
name=row['find'],
|
| 32 |
lat=[row['latitude']],
|
| 33 |
lon=[row['longitude']],
|
| 34 |
mode='markers',
|
| 35 |
marker=dict(
|
| 36 |
size=marker_size,
|
| 37 |
+
color=marker_colors[i % len(marker_colors)],
|
| 38 |
sizemode='diameter', # Размер маркера в диаметрах
|
| 39 |
),
|
| 40 |
text=row['find']
|
|
|
|
| 51 |
|
| 52 |
# Настройка карты
|
| 53 |
fig.update_layout(
|
| 54 |
+
mapbox_style="carto-darkmatter",
|
| 55 |
mapbox=dict(
|
| 56 |
center=dict(lat=center_lat, lon=center_lon),
|
| 57 |
zoom=zoom_level,
|
|
|
|
| 59 |
)
|
| 60 |
|
| 61 |
# Отображение карты в Streamlit
|
| 62 |
+
st.plotly_chart(fig, use_container_width=True)
|