Upload folder using huggingface_hub
Browse files- app/show_examples.py +43 -13
app/show_examples.py
CHANGED
|
@@ -29,9 +29,27 @@ def show_examples(category_name, dataset_name, model_lists):
|
|
| 29 |
</style>
|
| 30 |
"""
|
| 31 |
st.markdown(custom_css, unsafe_allow_html=True)
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
with st.container():
|
| 37 |
custom_css = """
|
|
@@ -67,16 +85,28 @@ def show_examples(category_name, dataset_name, model_lists):
|
|
| 67 |
model_lists.sort()
|
| 68 |
|
| 69 |
s = ''
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
<
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
|
| 81 |
body_details = f"""<table style="width:100%">
|
| 82 |
<thead>
|
|
|
|
| 29 |
</style>
|
| 30 |
"""
|
| 31 |
st.markdown(custom_css, unsafe_allow_html=True)
|
| 32 |
+
|
| 33 |
+
if dataset_name in ['CN-College-Listen-MCQ-Test', 'DREAM-TTS-MCQ-Test']:
|
| 34 |
+
|
| 35 |
+
choices = dataset[index]['other_attributes']['choices']
|
| 36 |
+
if isinstance(choices, str):
|
| 37 |
+
choices_text = choices
|
| 38 |
+
elif isinstance(choices, list):
|
| 39 |
+
choices_text = ' '.join(i for i in choices)
|
| 40 |
+
|
| 41 |
+
question_text = f"""<div class="my-container-question">
|
| 42 |
+
<p>QUESTION: {dataset[index]['instruction']['text']}</p>
|
| 43 |
+
<p>CHOICES: {choices_text}</p>
|
| 44 |
+
</div>
|
| 45 |
+
"""
|
| 46 |
+
else:
|
| 47 |
+
question_text = f"""<div class="my-container-question">
|
| 48 |
+
<p>QUESTION: {dataset[index]['instruction']['text']}</p>
|
| 49 |
+
</div>"""
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
st.markdown(question_text, unsafe_allow_html=True)
|
| 53 |
|
| 54 |
with st.container():
|
| 55 |
custom_css = """
|
|
|
|
| 85 |
model_lists.sort()
|
| 86 |
|
| 87 |
s = ''
|
| 88 |
+
if dataset_name in ['CN-College-Listen-MCQ-Test', 'DREAM-TTS-MCQ-Test']:
|
| 89 |
+
for model in model_lists:
|
| 90 |
+
try:
|
| 91 |
+
s += f"""<tr>
|
| 92 |
+
<td>{model}</td>
|
| 93 |
+
<td><p>{dataset[index][model]['text']}</p> <p>{choices_text}</p></td>
|
| 94 |
+
<td>{dataset[index][model]['model_prediction']}</td>
|
| 95 |
+
</tr>"""
|
| 96 |
+
except:
|
| 97 |
+
print(f"{model} is not in {dataset_name}")
|
| 98 |
+
continue
|
| 99 |
+
else:
|
| 100 |
+
for model in model_lists:
|
| 101 |
+
try:
|
| 102 |
+
s += f"""<tr>
|
| 103 |
+
<td>{model}</td>
|
| 104 |
+
<td>{dataset[index][model]['text']}</td>
|
| 105 |
+
<td>{dataset[index][model]['model_prediction']}</td>
|
| 106 |
+
</tr>"""
|
| 107 |
+
except:
|
| 108 |
+
print(f"{model} is not in {dataset_name}")
|
| 109 |
+
continue
|
| 110 |
|
| 111 |
body_details = f"""<table style="width:100%">
|
| 112 |
<thead>
|