Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Commit

Permalink
chore: better layout
Browse files Browse the repository at this point in the history
  • Loading branch information
d116626 committed Jan 24, 2024
1 parent b190ca0 commit 2cca7a6
Showing 1 changed file with 62 additions and 4 deletions.
66 changes: 62 additions & 4 deletions app/📣 Home.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,20 +177,36 @@ def get_agrid_table(data_with_image):


st.markdown("# Mapa de Alagamentos | Vision AI")
st.markdown(
"""
Esta aplicação usa as câmeras instaladas na cidade para detectar alagamentos e bolsões de água em tempo real.
Ela usa o modelo Gemini Pro Vision para identificar alagamentos em imagens.
"""
)


st.markdown(
f"""
**Ultima atualização**: {str(last_update)}
Status snapshots:
----
### Status snapshots:
- **Ultima atualização**: {str(last_update)}
- Total: {len(chart_data)}
- Sucessos: {len(data_with_image)}
- Falhas:{len(chart_data) - len(data_with_image)}
Selecione uma Camera para visualizar no mapa e exibir o snapshot.
----
### Tabela de Status de Alagamentos
""",
)

selected_row = get_agrid_table(data_with_image)
st.markdown("----")
st.markdown("### Mapa de Câmeras")
st.markdown("Selecione uma Câmera na tabela visualizar no mapa.")

if selected_row:
selected_camera_id = selected_row[0]["id_camera"]
Expand All @@ -204,11 +220,53 @@ def get_agrid_table(data_with_image):
map_data = st_folium(folium_map, key="fig1", height=600, width=1200)

image_url = camera_data.iloc[0]["image_url"]
st.markdown("----")
st.markdown("### 📷 Câmera snapshot")
st.markdown("Selecione uma Câmera na tabela visualizar o snapshot.")

if image_url is None:
st.markdown("Falha ao capturar o snapshot da camera.")
st.markdown("Falha ao capturar o snapshot da câmera.")
else:
st.image(image_url)


else:
map_data = st_folium(folium_map, key="fig1", height=600, width=1200)

st.markdown("----")
st.markdown("### 📷 Câmera snapshot")
st.markdown("Selecione uma Câmera na tabela visualizar o snapshot.")

# select chart_data obj based on last_object_clicked coordinates
obj_coord = map_data["last_object_clicked"]


# if obj_coord is None:
# st.write("Clique no marcador para ver mais detalhes.")
# else:
# selected_data = chart_data[
# (chart_data["latitude"] == obj_coord["lat"])
# & (chart_data["longitude"] == obj_coord["lng"])
# ]

# image_url = selected_data["image_url"].values[0]
# selected_data = (
# selected_data[["id_camera", "url_camera"]]
# .rename(
# columns={
# "id_camera": "ID",
# "url_camera": "🎥 Feed",
# }
# )
# .T
# )

# selected_data.columns = ["Informações"]

# st.markdown("### 📷 Camera snapshot")
# if image_url is None:
# st.markdown("Falha ao capturar o snapshot da câmera.")
# else:
# st.image(image_url)

# selected_data

0 comments on commit 2cca7a6

Please sign in to comment.