Zekun Wu
commited on
Commit
·
cc350c1
1
Parent(s):
f4322be
update
Browse files- pages/1_single_evaluation.py +17 -0
- pages/2_batch_evaluation.py +38 -12
pages/1_single_evaluation.py
CHANGED
@@ -35,6 +35,23 @@ def check_password():
|
|
35 |
# Title of the application
|
36 |
st.title('Natural Language Explanation Demo')
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
# Check if password has been validated
|
39 |
if not st.session_state.get('password_correct', False):
|
40 |
check_password()
|
|
|
35 |
# Title of the application
|
36 |
st.title('Natural Language Explanation Demo')
|
37 |
|
38 |
+
# Description of the application
|
39 |
+
st.write("""
|
40 |
+
### Welcome to the Natural Language Explanation Demo
|
41 |
+
This application allows you to evaluate the quality of explanations generated for various questions using different language models. You can either use predefined examples or input your own questions and explanations.
|
42 |
+
""")
|
43 |
+
|
44 |
+
# Explanation of principles
|
45 |
+
st.write("""
|
46 |
+
### Explanation Principles
|
47 |
+
When evaluating explanations, consider the following principles mapped to user empowerment and regulatory compliance outcomes:
|
48 |
+
|
49 |
+
1. **Factually Correct**: The information should be accurate and relevant to empower users and meet external audit requirements.
|
50 |
+
2. **Useful**: Explanations should be clear and meaningful, helping users make informed decisions.
|
51 |
+
3. **Context Specific**: Explanations should be tailored to the context of use, enhancing their relevance and utility.
|
52 |
+
4. **User Specific**: Explanations should address the needs and preferences of the user, enabling better decision-making.
|
53 |
+
5. **Provide Pluralism**: Explanations should present diverse perspectives, allowing users to understand different viewpoints and make well-rounded decisions.
|
54 |
+
""")
|
55 |
# Check if password has been validated
|
56 |
if not st.session_state.get('password_correct', False):
|
57 |
check_password()
|
pages/2_batch_evaluation.py
CHANGED
@@ -49,6 +49,23 @@ def batch_evaluate(uploaded_file):
|
|
49 |
# Title of the application
|
50 |
st.title('Natural Language Explanation Demo')
|
51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
# Check if password has been validated
|
53 |
if not st.session_state.get('password_correct', False):
|
54 |
check_password()
|
@@ -56,18 +73,27 @@ else:
|
|
56 |
st.sidebar.success("Password Verified. Proceed with the demo.")
|
57 |
|
58 |
st.write("""
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
|
72 |
uploaded_file = st.file_uploader("Upload CSV file with 'question' and 'explanation' columns", type=['csv'])
|
73 |
|
|
|
49 |
# Title of the application
|
50 |
st.title('Natural Language Explanation Demo')
|
51 |
|
52 |
+
# Description of the application
|
53 |
+
st.write("""
|
54 |
+
### Welcome to the Natural Language Explanation Demo
|
55 |
+
This application allows you to evaluate the quality of explanations generated for various questions using different language models. You can either use predefined examples or input your own questions and explanations.
|
56 |
+
""")
|
57 |
+
|
58 |
+
# Explanation of principles
|
59 |
+
st.write("""
|
60 |
+
### Explanation Principles
|
61 |
+
When evaluating explanations, consider the following principles mapped to user empowerment and regulatory compliance outcomes:
|
62 |
+
|
63 |
+
1. **Factually Correct**: The information should be accurate and relevant to empower users and meet external audit requirements.
|
64 |
+
2. **Useful**: Explanations should be clear and meaningful, helping users make informed decisions.
|
65 |
+
3. **Context Specific**: Explanations should be tailored to the context of use, enhancing their relevance and utility.
|
66 |
+
4. **User Specific**: Explanations should address the needs and preferences of the user, enabling better decision-making.
|
67 |
+
5. **Provide Pluralism**: Explanations should present diverse perspectives, allowing users to understand different viewpoints and make well-rounded decisions.
|
68 |
+
""")
|
69 |
# Check if password has been validated
|
70 |
if not st.session_state.get('password_correct', False):
|
71 |
check_password()
|
|
|
73 |
st.sidebar.success("Password Verified. Proceed with the demo.")
|
74 |
|
75 |
st.write("""
|
76 |
+
### Instructions for Uploading CSV
|
77 |
+
Please upload a CSV file with the following columns:
|
78 |
+
- `question`: The question you want evaluated.
|
79 |
+
- `explanation`: The explanation corresponding to the question.
|
80 |
+
|
81 |
+
**Example CSV Format:**
|
82 |
+
""")
|
83 |
+
|
84 |
+
# Display an example DataFrame
|
85 |
+
example_data = {
|
86 |
+
"question": [
|
87 |
+
"What causes rainbows to appear in the sky?",
|
88 |
+
"Why is the sky blue?"
|
89 |
+
],
|
90 |
+
"explanation": [
|
91 |
+
"Rainbows appear when sunlight is refracted, dispersed, and reflected inside water droplets in the atmosphere, resulting in a spectrum of light appearing in the sky.",
|
92 |
+
"The sky is blue because molecules in the air scatter blue light from the sun more than they scatter red light."
|
93 |
+
]
|
94 |
+
}
|
95 |
+
example_df = pd.DataFrame(example_data)
|
96 |
+
st.dataframe(example_df)
|
97 |
|
98 |
uploaded_file = st.file_uploader("Upload CSV file with 'question' and 'explanation' columns", type=['csv'])
|
99 |
|