Upload folder using huggingface_hub
Browse files- app/content.py +1 -3
- app/draw_diagram.py +58 -51
- app/pages.py +6 -18
    	
        app/content.py
    CHANGED
    
    | @@ -145,9 +145,7 @@ dataset_diaplay_information = { | |
| 145 | 
             
                'YTB-SQA-Batch1': 'Under Development',
         | 
| 146 | 
             
                'YTB-SDS-Batch1': 'Under Development',
         | 
| 147 | 
             
                'YTB-PQA-Batch1': 'Under Development',
         | 
| 148 | 
            -
                
         | 
| 149 | 
            -
                            }
         | 
| 150 | 
            -
             | 
| 151 |  | 
| 152 |  | 
| 153 |  | 
|  | |
| 145 | 
             
                'YTB-SQA-Batch1': 'Under Development',
         | 
| 146 | 
             
                'YTB-SDS-Batch1': 'Under Development',
         | 
| 147 | 
             
                'YTB-PQA-Batch1': 'Under Development',
         | 
| 148 | 
            +
                }
         | 
|  | |
|  | |
| 149 |  | 
| 150 |  | 
| 151 |  | 
    	
        app/draw_diagram.py
    CHANGED
    
    | @@ -1,6 +1,8 @@ | |
| 1 | 
             
            import streamlit as st
         | 
| 2 | 
             
            import pandas as pd
         | 
| 3 | 
             
            import numpy as np
         | 
|  | |
|  | |
| 4 | 
             
            from streamlit_echarts import st_echarts
         | 
| 5 | 
             
            from app.show_examples import *
         | 
| 6 | 
             
            from app.content import *
         | 
| @@ -11,47 +13,56 @@ from model_information import get_dataframe | |
| 11 | 
             
            info_df = get_dataframe()
         | 
| 12 |  | 
| 13 |  | 
| 14 | 
            -
            def  | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 15 |  | 
| 16 | 
            -
                folder = f"./results_organized/{metrics}/"
         | 
| 17 |  | 
| 18 | 
            -
                # Load the results from CSV
         | 
| 19 | 
            -
                data_path = f'{folder}/{category_name.lower()}.csv'
         | 
| 20 | 
            -
                chart_data = pd.read_csv(data_path).round(3)
         | 
| 21 |  | 
| 22 | 
            -
                dataset_name = displayname2datasetname[displayname]
         | 
| 23 | 
            -
                chart_data = chart_data[['Model', dataset_name]]
         | 
| 24 | 
            -
             | 
| 25 | 
            -
                # Rename to proper display name
         | 
| 26 | 
            -
                chart_data = chart_data.rename(columns=datasetname2diaplayname)
         | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 29 | 
            -
                 | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 39 | 
            -
                            """, unsafe_allow_html=True)
         | 
| 40 |  | 
| 41 | 
            -
                # remap model names
         | 
| 42 | 
            -
                display_model_names = {key.strip() :val.strip() for key, val in zip(info_df['Original Name'], info_df['Proper Display Name'])}
         | 
| 43 | 
            -
                chart_data['model_show'] = chart_data['Model'].map(lambda x: display_model_names.get(x, x))
         | 
| 44 |  | 
| 45 |  | 
| 46 | 
            -
                models = st.multiselect("Please choose the model", 
         | 
| 47 | 
            -
             | 
| 48 | 
            -
             | 
| 49 | 
            -
             | 
| 50 |  | 
| 51 | 
            -
                chart_data = chart_data[chart_data['model_show'].isin(models)]
         | 
| 52 | 
            -
                chart_data = chart_data.sort_values(by=[displayname], ascending=cus_sort).dropna(axis=0)
         | 
| 53 |  | 
| 54 | 
            -
                if len(chart_data) == 0: return
         | 
| 55 |  | 
| 56 |  | 
| 57 |  | 
| @@ -62,28 +73,27 @@ def draw(folder_name, category_name, displayname, metrics, cus_sort=True): | |
| 62 | 
             
                with st.container():
         | 
| 63 | 
             
                    st.markdown('##### TABLE')
         | 
| 64 |  | 
| 65 | 
            -
                    
         | 
| 66 | 
            -
                    model_link = {key.strip(): val for key, val in zip(info_df['Proper Display Name'], info_df['Link'])}
         | 
| 67 |  | 
| 68 | 
            -
                     | 
|  | |
| 69 |  | 
| 70 | 
            -
                     | 
|  | |
|  | |
| 71 |  | 
| 72 | 
             
                    # Format numeric columns to 2 decimal places
         | 
| 73 | 
             
                    #chart_data_table[chart_data_table.columns[1]] = chart_data_table[chart_data_table.columns[1]].apply(lambda x: round(float(x), 3) if isinstance(float(x), (int, float)) else float(x))
         | 
| 74 | 
            -
                     | 
| 75 |  | 
| 76 |  | 
| 77 | 
             
                    def highlight_first_element(x):
         | 
| 78 | 
             
                            # Create a DataFrame with the same shape as the input
         | 
| 79 | 
             
                            df_style = pd.DataFrame('', index=x.index, columns=x.columns)
         | 
| 80 | 
            -
                            # Apply background color to the first element in row 0 (df[0][0])
         | 
| 81 | 
            -
                            # df_style.iloc[0, 1] = 'background-color: #b0c1d7; color: white'
         | 
| 82 | 
             
                            df_style.iloc[0, 1] = 'background-color: #b0c1d7'
         | 
| 83 | 
            -
                            
         | 
| 84 | 
             
                            return df_style
         | 
| 85 |  | 
| 86 | 
            -
                    if  | 
| 87 | 
             
                                        'LibriSpeech-Clean',
         | 
| 88 | 
             
                                        'LibriSpeech-Other',
         | 
| 89 | 
             
                                        'CommonVoice-15-EN',
         | 
| @@ -136,11 +146,9 @@ def draw(folder_name, category_name, displayname, metrics, cus_sort=True): | |
| 136 | 
             
                    st.dataframe(
         | 
| 137 | 
             
                            styled_df,
         | 
| 138 | 
             
                            column_config={
         | 
| 139 | 
            -
                                'model_show': 'Model',
         | 
| 140 | 
             
                                chart_data_table.columns[1]: {'alignment': 'left'},
         | 
| 141 | 
            -
                                "model_link": st.column_config.LinkColumn(
         | 
| 142 | 
            -
                                    "Model Link",
         | 
| 143 | 
            -
                                ),
         | 
| 144 | 
             
                            },
         | 
| 145 | 
             
                            hide_index=True,
         | 
| 146 | 
             
                            use_container_width=True
         | 
| @@ -166,7 +174,7 @@ def draw(folder_name, category_name, displayname, metrics, cus_sort=True): | |
| 166 | 
             
                        st.markdown('##### CHART')
         | 
| 167 |  | 
| 168 | 
             
                        # Get Values
         | 
| 169 | 
            -
                        data_values =  | 
| 170 |  | 
| 171 | 
             
                        # Calculate Q1 and Q3
         | 
| 172 | 
             
                        q1 = data_values.quantile(0.25)
         | 
| @@ -201,7 +209,7 @@ def draw(folder_name, category_name, displayname, metrics, cus_sort=True): | |
| 201 | 
             
                                    "type": "category",
         | 
| 202 | 
             
                                    "boundaryGap": True,
         | 
| 203 | 
             
                                    "triggerEvent": True,
         | 
| 204 | 
            -
                                    "data":   | 
| 205 | 
             
                                }
         | 
| 206 | 
             
                            ],
         | 
| 207 | 
             
                            "yAxis": [{"type": "value", 
         | 
| @@ -211,9 +219,9 @@ def draw(folder_name, category_name, displayname, metrics, cus_sort=True): | |
| 211 | 
             
                                        # "splitNumber": 10
         | 
| 212 | 
             
                                        }],
         | 
| 213 | 
             
                            "series": [{
         | 
| 214 | 
            -
                                    "name": f"{ | 
| 215 | 
             
                                    "type": "bar",
         | 
| 216 | 
            -
                                    "data":  | 
| 217 | 
             
                                }],
         | 
| 218 | 
             
                        }
         | 
| 219 |  | 
| @@ -242,7 +250,6 @@ def draw(folder_name, category_name, displayname, metrics, cus_sort=True): | |
| 242 | 
             
                    st.session_state.show_examples = not st.session_state.show_examples
         | 
| 243 |  | 
| 244 | 
             
                if st.session_state.show_examples:
         | 
| 245 | 
            -
                    
         | 
| 246 | 
             
                    st.markdown('To be implemented')
         | 
| 247 |  | 
| 248 | 
             
                    # # if dataset_name in ['Earnings21-Test', 'Earnings22-Test', 'Tedlium3-Test', 'Tedlium3-Long-form-Test']:
         | 
|  | |
| 1 | 
             
            import streamlit as st
         | 
| 2 | 
             
            import pandas as pd
         | 
| 3 | 
             
            import numpy as np
         | 
| 4 | 
            +
            import json
         | 
| 5 | 
            +
             | 
| 6 | 
             
            from streamlit_echarts import st_echarts
         | 
| 7 | 
             
            from app.show_examples import *
         | 
| 8 | 
             
            from app.content import *
         | 
|  | |
| 13 | 
             
            info_df = get_dataframe()
         | 
| 14 |  | 
| 15 |  | 
| 16 | 
            +
            def draw_table(dataset_displayname, metrics):
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                dataset_nickname = displayname2datasetname[dataset_displayname]
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                with open('organize_model_results.json', 'r') as f:
         | 
| 21 | 
            +
                    organize_model_results = json.load(f)
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                model_results      = organize_model_results[dataset_nickname][metrics]
         | 
| 24 | 
            +
                model_name_mapping = {key.strip(): val for key, val in zip(info_df['Original Name'], info_df['Proper Display Name'])}
         | 
| 25 | 
            +
                model_results      = {model_name_mapping.get(key, key): val for key, val in model_results.items()}
         | 
| 26 | 
            +
             | 
| 27 |  | 
| 28 | 
            +
                # folder = f"./results_organized/{metrics}/"
         | 
| 29 |  | 
| 30 | 
            +
                # # Load the results from CSV
         | 
| 31 | 
            +
                # data_path = f'{folder}/{category_name.lower()}.csv'
         | 
| 32 | 
            +
                # chart_data = pd.read_csv(data_path).round(3)
         | 
| 33 |  | 
| 34 | 
            +
                # dataset_name = displayname2datasetname[displayname]
         | 
| 35 | 
            +
                # chart_data = chart_data[['Model', dataset_name]]
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                # # Rename to proper display name
         | 
| 38 | 
            +
                # chart_data = chart_data.rename(columns=datasetname2diaplayname)
         | 
| 39 | 
            +
             | 
| 40 | 
            +
                # st.markdown("""
         | 
| 41 | 
            +
                #             <style>
         | 
| 42 | 
            +
                #             .stMultiSelect [data-baseweb=select] span {
         | 
| 43 | 
            +
                #                 max-width: 800px;
         | 
| 44 | 
            +
                #                 font-size: 0.9rem;
         | 
| 45 | 
            +
                #                 background-color: #3C6478 !important; /* Background color for selected items */
         | 
| 46 | 
            +
                #                 color: white; /* Change text color */
         | 
| 47 | 
            +
                #                 back
         | 
| 48 | 
            +
                #             }
         | 
| 49 | 
            +
                #             </style>
         | 
| 50 | 
            +
                #             """, unsafe_allow_html=True)
         | 
|  | |
| 51 |  | 
| 52 | 
            +
                # # remap model names
         | 
| 53 | 
            +
                # display_model_names = {key.strip() :val.strip() for key, val in zip(info_df['Original Name'], info_df['Proper Display Name'])}
         | 
| 54 | 
            +
                # chart_data['model_show'] = chart_data['Model'].map(lambda x: display_model_names.get(x, x))
         | 
| 55 |  | 
| 56 |  | 
| 57 | 
            +
                # models = st.multiselect("Please choose the model", 
         | 
| 58 | 
            +
                #                         sorted(chart_data['model_show'].tolist()), 
         | 
| 59 | 
            +
                #                         default = sorted(chart_data['model_show'].tolist()),
         | 
| 60 | 
            +
                #                         )
         | 
| 61 |  | 
| 62 | 
            +
                # chart_data = chart_data[chart_data['model_show'].isin(models)]
         | 
| 63 | 
            +
                # chart_data = chart_data.sort_values(by=[displayname], ascending=cus_sort).dropna(axis=0)
         | 
| 64 |  | 
| 65 | 
            +
                # if len(chart_data) == 0: return
         | 
| 66 |  | 
| 67 |  | 
| 68 |  | 
|  | |
| 73 | 
             
                with st.container():
         | 
| 74 | 
             
                    st.markdown('##### TABLE')
         | 
| 75 |  | 
| 76 | 
            +
                    model_link_mapping = {key.strip(): val for key, val in zip(info_df['Proper Display Name'], info_df['Link'])}
         | 
|  | |
| 77 |  | 
| 78 | 
            +
                    chart_data_table = pd.DataFrame(list(model_results.items()), columns=["model_show", dataset_displayname])
         | 
| 79 | 
            +
                    chart_data_table["model_link"] = chart_data_table["model_show"].map(model_link_mapping)
         | 
| 80 |  | 
| 81 | 
            +
                    # chart_data['model_link'] = chart_data['model_show'].map(model_link) 
         | 
| 82 | 
            +
             | 
| 83 | 
            +
                    # chart_data_table = chart_data[['model_show', chart_data.columns[1], chart_data.columns[3]]]
         | 
| 84 |  | 
| 85 | 
             
                    # Format numeric columns to 2 decimal places
         | 
| 86 | 
             
                    #chart_data_table[chart_data_table.columns[1]] = chart_data_table[chart_data_table.columns[1]].apply(lambda x: round(float(x), 3) if isinstance(float(x), (int, float)) else float(x))
         | 
| 87 | 
            +
                    # dataset_name = chart_data_table.columns[1]
         | 
| 88 |  | 
| 89 |  | 
| 90 | 
             
                    def highlight_first_element(x):
         | 
| 91 | 
             
                            # Create a DataFrame with the same shape as the input
         | 
| 92 | 
             
                            df_style = pd.DataFrame('', index=x.index, columns=x.columns)
         | 
|  | |
|  | |
| 93 | 
             
                            df_style.iloc[0, 1] = 'background-color: #b0c1d7'
         | 
|  | |
| 94 | 
             
                            return df_style
         | 
| 95 |  | 
| 96 | 
            +
                    if dataset_displayname in [
         | 
| 97 | 
             
                                        'LibriSpeech-Clean',
         | 
| 98 | 
             
                                        'LibriSpeech-Other',
         | 
| 99 | 
             
                                        'CommonVoice-15-EN',
         | 
|  | |
| 146 | 
             
                    st.dataframe(
         | 
| 147 | 
             
                            styled_df,
         | 
| 148 | 
             
                            column_config={
         | 
| 149 | 
            +
                                'model_show'               : 'Model',
         | 
| 150 | 
             
                                chart_data_table.columns[1]: {'alignment': 'left'},
         | 
| 151 | 
            +
                                "model_link"               : st.column_config.LinkColumn("Model Link"),
         | 
|  | |
|  | |
| 152 | 
             
                            },
         | 
| 153 | 
             
                            hide_index=True,
         | 
| 154 | 
             
                            use_container_width=True
         | 
|  | |
| 174 | 
             
                        st.markdown('##### CHART')
         | 
| 175 |  | 
| 176 | 
             
                        # Get Values
         | 
| 177 | 
            +
                        data_values = chart_data_table.iloc[:, 1]
         | 
| 178 |  | 
| 179 | 
             
                        # Calculate Q1 and Q3
         | 
| 180 | 
             
                        q1 = data_values.quantile(0.25)
         | 
|  | |
| 209 | 
             
                                    "type": "category",
         | 
| 210 | 
             
                                    "boundaryGap": True,
         | 
| 211 | 
             
                                    "triggerEvent": True,
         | 
| 212 | 
            +
                                    "data":  chart_data_table['model_show'].tolist(),
         | 
| 213 | 
             
                                }
         | 
| 214 | 
             
                            ],
         | 
| 215 | 
             
                            "yAxis": [{"type": "value", 
         | 
|  | |
| 219 | 
             
                                        # "splitNumber": 10
         | 
| 220 | 
             
                                        }],
         | 
| 221 | 
             
                            "series": [{
         | 
| 222 | 
            +
                                    "name": f"{dataset_nickname}",
         | 
| 223 | 
             
                                    "type": "bar",
         | 
| 224 | 
            +
                                    "data": chart_data_table[f'{dataset_displayname}'].tolist(),
         | 
| 225 | 
             
                                }],
         | 
| 226 | 
             
                        }
         | 
| 227 |  | 
|  | |
| 250 | 
             
                    st.session_state.show_examples = not st.session_state.show_examples
         | 
| 251 |  | 
| 252 | 
             
                if st.session_state.show_examples:
         | 
|  | |
| 253 | 
             
                    st.markdown('To be implemented')
         | 
| 254 |  | 
| 255 | 
             
                    # # if dataset_name in ['Earnings21-Test', 'Earnings22-Test', 'Tedlium3-Test', 'Tedlium3-Long-form-Test']:
         | 
    	
        app/pages.py
    CHANGED
    
    | @@ -4,7 +4,6 @@ from app.content import * | |
| 4 | 
             
            from app.summarization import *
         | 
| 5 |  | 
| 6 | 
             
            def dataset_contents(dataset, metrics):
         | 
| 7 | 
            -
                
         | 
| 8 | 
             
                custom_css = """
         | 
| 9 | 
             
                            <style>
         | 
| 10 | 
             
                            .my-dataset-info {
         | 
| @@ -39,7 +38,6 @@ def dashboard(): | |
| 39 | 
             
                        **Resource for AudioLLMs:** [][gh2]
         | 
| 40 | 
             
                        """)
         | 
| 41 |  | 
| 42 | 
            -
             | 
| 43 | 
             
                st.markdown("""
         | 
| 44 | 
             
                        #### Recent updates
         | 
| 45 | 
             
                        - **Jan. 2025**: AudioBench is officially accepted to NAACL 2025!
         | 
| @@ -51,7 +49,6 @@ def dashboard(): | |
| 51 | 
             
                        """)
         | 
| 52 |  | 
| 53 | 
             
                st.divider()
         | 
| 54 | 
            -
                
         | 
| 55 | 
             
                st.markdown("""
         | 
| 56 | 
             
                            #### Evaluating Audio-based Large Language Models
         | 
| 57 |  | 
| @@ -62,9 +59,7 @@ def dashboard(): | |
| 62 | 
             
                            """
         | 
| 63 | 
             
                            )
         | 
| 64 |  | 
| 65 | 
            -
             | 
| 66 | 
            -
                with st.container():
         | 
| 67 | 
            -
                    
         | 
| 68 | 
             
                    st.markdown('''
         | 
| 69 | 
             
                            ''')
         | 
| 70 |  | 
| @@ -113,15 +108,9 @@ def dashboard(): | |
| 113 | 
             
                                        year={2024}
         | 
| 114 | 
             
                                        }
         | 
| 115 | 
             
                                    ```
         | 
| 116 | 
            -
             | 
| 117 | 
             
                                    """)
         | 
| 118 |  | 
| 119 |  | 
| 120 | 
            -
             | 
| 121 | 
            -
             | 
| 122 | 
            -
             | 
| 123 | 
            -
             | 
| 124 | 
            -
             | 
| 125 | 
             
            def asr_english():
         | 
| 126 | 
             
                st.title("Task: Automatic Speech Recognition - English")
         | 
| 127 |  | 
| @@ -143,15 +132,14 @@ def asr_english(): | |
| 143 | 
             
                left, center, _, middle, right = st.columns([0.4, 0.2, 0.2, 0.2 ,0.2])
         | 
| 144 |  | 
| 145 | 
             
                with left:
         | 
| 146 | 
            -
                     | 
| 147 |  | 
| 148 | 
            -
                if  | 
| 149 | 
            -
                    if  | 
| 150 | 
             
                        sum_table_mulit_metrix('asr_english', ['wer'])
         | 
| 151 | 
             
                    else:
         | 
| 152 | 
            -
                        dataset_contents(dataset_diaplay_information[ | 
| 153 | 
            -
                         | 
| 154 | 
            -
             | 
| 155 |  | 
| 156 |  | 
| 157 |  | 
|  | |
| 4 | 
             
            from app.summarization import *
         | 
| 5 |  | 
| 6 | 
             
            def dataset_contents(dataset, metrics):
         | 
|  | |
| 7 | 
             
                custom_css = """
         | 
| 8 | 
             
                            <style>
         | 
| 9 | 
             
                            .my-dataset-info {
         | 
|  | |
| 38 | 
             
                        **Resource for AudioLLMs:** [][gh2]
         | 
| 39 | 
             
                        """)
         | 
| 40 |  | 
|  | |
| 41 | 
             
                st.markdown("""
         | 
| 42 | 
             
                        #### Recent updates
         | 
| 43 | 
             
                        - **Jan. 2025**: AudioBench is officially accepted to NAACL 2025!
         | 
|  | |
| 49 | 
             
                        """)
         | 
| 50 |  | 
| 51 | 
             
                st.divider()
         | 
|  | |
| 52 | 
             
                st.markdown("""
         | 
| 53 | 
             
                            #### Evaluating Audio-based Large Language Models
         | 
| 54 |  | 
|  | |
| 59 | 
             
                            """
         | 
| 60 | 
             
                            )
         | 
| 61 |  | 
| 62 | 
            +
                with st.container():        
         | 
|  | |
|  | |
| 63 | 
             
                    st.markdown('''
         | 
| 64 | 
             
                            ''')
         | 
| 65 |  | 
|  | |
| 108 | 
             
                                        year={2024}
         | 
| 109 | 
             
                                        }
         | 
| 110 | 
             
                                    ```
         | 
|  | |
| 111 | 
             
                                    """)
         | 
| 112 |  | 
| 113 |  | 
|  | |
|  | |
|  | |
|  | |
|  | |
| 114 | 
             
            def asr_english():
         | 
| 115 | 
             
                st.title("Task: Automatic Speech Recognition - English")
         | 
| 116 |  | 
|  | |
| 132 | 
             
                left, center, _, middle, right = st.columns([0.4, 0.2, 0.2, 0.2 ,0.2])
         | 
| 133 |  | 
| 134 | 
             
                with left:
         | 
| 135 | 
            +
                    tab_section = st.selectbox('Dataset', filters_levelone)
         | 
| 136 |  | 
| 137 | 
            +
                if tab_section:
         | 
| 138 | 
            +
                    if tab_section in sum:
         | 
| 139 | 
             
                        sum_table_mulit_metrix('asr_english', ['wer'])
         | 
| 140 | 
             
                    else:
         | 
| 141 | 
            +
                        dataset_contents(dataset_diaplay_information[tab_section], metrics_info['wer'])
         | 
| 142 | 
            +
                        draw_table(tab_section, 'wer')
         | 
|  | |
| 143 |  | 
| 144 |  | 
| 145 |  | 
 
			

