import streamlit as st import datasets import numpy as np def show_examples(category_name, dataset_name, model_lists): st.divider() sample_folder = f"./examples/{category_name}/{dataset_name}" dataset = datasets.load_from_disk(sample_folder) for index in range(len(dataset)): with st.container(): st.markdown(f'##### EXAMPLE {index+1}') col1, col2 = st.columns([0.3, 0.7], vertical_alignment="center") with col1: st.audio(f'{sample_folder}/sample_{index}.wav', format="audio/wav") with col2: with st.container(): custom_css = """ """ st.markdown(custom_css, unsafe_allow_html=True) if dataset_name in ['CN-College-Listen-MCQ-Test', 'DREAM-TTS-MCQ-Test']: choices = dataset[index]['other_attributes']['choices'] if isinstance(choices, str): choices_text = choices elif isinstance(choices, list): choices_text = ' '.join(i for i in choices) question_text = f"""
QUESTION: {dataset[index]['instruction']['text']}
CHOICES: {choices_text}
QUESTION: {dataset[index]['instruction']['text']}
CORRECT ANSWER: {dataset[index]['answer']['text']}
{dataset[index][model]['text']}
{choices_text}
MODEL | QUESTION | MODEL PREDICTION |
---|