Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
import streamlit as st | |
def show_requests_filters(): | |
HEADERS_MAPPING = { | |
"إغاثة": _("Rescue"), | |
"مساعدة طبية": _("Medical Assistance"), | |
"مأوى": _("Shelter"), | |
"طعام وماء": _("Food & Water"), | |
"مخاطر (تسرب الغاز، تلف في الخدمات العامة...)": _("Danger"), | |
} | |
options = [ | |
"إغاثة", | |
"مساعدة طبية", | |
"مأوى", | |
"طعام وماء", | |
"مخاطر (تسرب الغاز، تلف في الخدمات العامة...)", | |
] | |
selected_options = [] | |
col1, col2 = st.columns([1, 1]) | |
with col1: | |
show_unverified = st.checkbox( | |
_("Display unverified requests"), | |
value=False, | |
) | |
with col2: | |
show_interventions = st.checkbox( | |
_("Display Interventions"), | |
value=True, | |
) | |
st.markdown(_("👉 **Choose request type**")) | |
selected_options = st.multiselect( | |
"Choose request type", | |
options=options, | |
default=options, | |
format_func=lambda x: HEADERS_MAPPING[x], | |
label_visibility="collapsed", | |
) | |
return selected_options, options, show_unverified, show_interventions | |
def show_interventions_filters(): | |
st.markdown( | |
_("👉 **State of villages visited by NGOs**"), | |
unsafe_allow_html=True, | |
) | |
status_mapping = { | |
"Critique, Besoin d'aide en urgence / Critical, in urgent need of help": _("🚨 Critical"), | |
"Partiellement satisfait / Partially Served": _("⚠️ Partially served"), | |
"Entièrement satisfait / Fully served": _("✅ Fully served"), | |
} | |
# Let's use multiselect instead | |
selected_statuses = st.multiselect( | |
"Choose status", | |
options=status_mapping.keys(), | |
default=status_mapping.keys(), | |
format_func=lambda x: status_mapping[x], | |
label_visibility="collapsed", | |
) | |
return selected_statuses | |