CoolFace
Apppublic

GEM/DatasetCardForm

sourceHugging Faceupdated 4y agoView on Hugging Face
9likes
results.py96 linesDownload Raw Back to datacards
1import streamlit as st2 3from .streamlit_utils import (4    make_multiselect,5    make_selectbox,6    make_text_area,7    make_text_input,8    make_radio,9)10 11N_FIELDS = 712 13 14def results_page():15    st.session_state.card_dict["results"] = st.session_state.card_dict.get(16        "results", {}17    )18 19    with st.expander("Previous Results", expanded=False):20        key_pref = ["results", "results"]21        st.session_state.card_dict["results"]["results"] = st.session_state.card_dict[22            "results"23        ].get("results", {})24        make_text_area(25            label="What aspect of model ability can be measured with this dataset?",26            key_list=key_pref + ["model-abilities"],27            help="What kind of abilities should a model exhibit that performs well on the task of this dataset (e.g., reasoning capability, morphological inflection)?.",28        )29        make_multiselect(30            label="What metrics are typically used for this task?",31            key_list=key_pref + ["metrics"],32            options=[33                "BERT-Score",34                "BLEU",35                "BLEURT",36                "ChrF",37                "Entailment",38                "FeQA",39                "METEOR", "MoverScore",40                "QAGS",41                "ROUGE",42                "WER",43                "Other: Other Metrics"44            ],45            help="Select all metrics that are typically used when evaluating models for this task.",46        )47        if "Other: Other Metrics" in st.session_state.card_dict["results"]["results"].get("metrics", []):48            make_text_area(49                label="Definitions of other metrics",50                key_list=key_pref + ["other-metrics-definitions"],51                help="If the evaluation strategies in the previous questions go beyond the list of metrics above, add descriptions and/or definitions for each metric.",52            )53        else:54            st.session_state.card_dict["results"]["results"]["other-metrics-definitions"] = "N/A"55        make_text_area(56            label="List and describe the purpose of the metrics and evaluation methodology (including human evaluation) that the dataset creators used when introducing this task.",57            key_list=key_pref + ["original-evaluation"],58            help="When the generation task was not evaluated when this dataset was introduced, write N/A.",59        )60        make_radio(61            label="Are previous results available?",62            options=["no", "yes"],63            key_list=key_pref + ["has-previous-results"],64            help="Have papers evaluated models on this task? If no, write N/A for the following three questions.",65        )66        if st.session_state.card_dict["results"]["results"]["has-previous-results"] == "yes":67            make_text_area(68                label="What evaluation approaches have others used?",69                key_list=key_pref + ["current-evaluation"],70                help="If the current evaluation strategy diverts from the original, describe how models are being evaluated.",71            )72            make_text_area(73                label="What are the most relevant previous results for this task/dataset?",74                key_list=key_pref + ["previous-results"],75                help="List and describe the source and performance metrics for models on this dataset.",76            )77        else:78            st.session_state.card_dict["results"]["results"]["current-evaluation"] = "N/A"79            st.session_state.card_dict["results"]["results"]["previous-results"] = "N/A"80 81 82 83def results_summary():84    total_filled = sum(85        [len(dct) for dct in st.session_state.card_dict.get("results", {}).values()]86    )87    with st.expander(88        f"Previous Results Completion - {total_filled} of {N_FIELDS}", expanded=False89    ):90        completion_markdown = ""91        completion_markdown += (92            f"- **Overall completion:**\n  - {total_filled} of {N_FIELDS} fields\n"93        )94        completion_markdown += f"- **Sub-section - Previous Results:**\n  - {len(st.session_state.card_dict.get('results', {}).get('results', {}))} of {N_FIELDS} fields\n"95        st.markdown(completion_markdown)96