Sebastian Gehrmann
.
3578aa2
raw history blame
No virus
3.71 kB
import streamlit as st
from .streamlit_utils import (
make_multiselect,
make_selectbox,
make_text_area,
make_text_input,
make_radio,
)
N_FIELDS_SOCIAL_IMPACT = 9
N_FIELDS_UNDERSERVED_COMMUNITIES = 8
N_FIELDS_BIASES= 3
N_FIELDS = N_FIELDS_SOCIAL_IMPACT + N_FIELDS_UNDERSERVED_COMMUNITIES + N_FIELDS_BIASES
def context_page():
st.session_state.card_dict["context"] = st.session_state.card_dict.get(
"context", {}
)
with st.expander("Social Impact of the Dataset", expanded=False):
key_pref = ["context", "social-impact"]
st.session_state.card_dict["context"]["social-impact"] = st.session_state.card_dict[
"context"
].get("social-impact", {})
make_text_area(
label="What tasks has this dataset been used for previously?",
key_list=key_pref + [""],
help="",
)
make_text_area(
label="Did any of these previous uses result in observations about the dataset?",
key_list=key_pref + [""],
help="",
)
make_text_area(
label="Have any changes been made to the dataset as a result of these observations?",
key_list=key_pref + [""],
help="",
)
make_text_area(
label="Task",
key_list=key_pref + [""],
help="",
)
make_text_area(
label="Dataset-specific",
key_list=key_pref + [""],
help="",
)
with st.expander("Impact on Under-Served Communities", expanded=False):
key_pref = ["context", "underserved"]
st.session_state.card_dict["context"]["underserved"] = st.session_state.card_dict[
"context"
].get("underserved", {})
with st.expander("Discussion of Biases", expanded=False):
key_pref = ["context", "biases"]
st.session_state.card_dict["context"]["biases"] = st.session_state.card_dict[
"context"
].get("biases", {})
make_text_area(
label="Are there documented biases in the data?",
key_list=key_pref + [""],
help="",
)
make_text_area(
label="Link to analyses",
key_list=key_pref + [""],
help="",
)
make_text_area(
label="How does the distribution of language producers differ from a base distribution?",
key_list=key_pref + [""],
help="",
)
make_text_area(
label="Topic coverage?",
key_list=key_pref + [""],
help="",
)
def context_summary():
total_filled = sum(
[len(dct) for dct in st.session_state.card_dict.get("context", {}).values()]
)
with st.expander(
f"Broader Social Context Completion - {total_filled} of {N_FIELDS}", expanded=False
):
completion_markdown = ""
completion_markdown += (
f"- **Overall competion:**\n - {total_filled} of {N_FIELDS} fields\n"
)
completion_markdown += f"- **Sub-section - Social Impact of the Dataset:**\n - {len(st.session_state.card_dict.get('context', {}).get('social-impact', {}))} of {N_FIELDS_SOCIAL_IMPACT} fields\n"
completion_markdown += f"- **Sub-section - Impact on Under-Served Communities:**\n - {len(st.session_state.card_dict.get('context', {}).get('underserved', {}))} of {N_FIELDS_UNDERSERVED_COMMUNITIES} fields\n"
completion_markdown += f"- **Sub-section - Discussion of Biases:**\n - {len(st.session_state.card_dict.get('context', {}).get('biases', {}))} of {N_FIELDS_BIASES} fields\n"
st.markdown(completion_markdown)