Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1026,121 +1026,89 @@ def display_evaluation(evaluation: Dict[str, Any]):
|
|
| 1026 |
if "summary" in recommendations:
|
| 1027 |
st.markdown("""
|
| 1028 |
<div class="summary-card">
|
| 1029 |
-
<h4>π Overall
|
| 1030 |
<div class="summary-content">
|
| 1031 |
-
|
| 1032 |
-
|
| 1033 |
-
|
|
|
|
| 1034 |
|
| 1035 |
-
# Display improvements
|
| 1036 |
st.markdown("<h4>π‘ Areas for Improvement</h4>", unsafe_allow_html=True)
|
| 1037 |
improvements = recommendations.get("improvements", [])
|
| 1038 |
|
| 1039 |
-
|
| 1040 |
-
|
| 1041 |
-
|
| 1042 |
-
|
| 1043 |
-
|
| 1044 |
-
|
| 1045 |
-
|
| 1046 |
-
|
| 1047 |
-
|
| 1048 |
-
|
| 1049 |
-
|
| 1050 |
-
|
| 1051 |
-
|
| 1052 |
-
|
| 1053 |
-
|
| 1054 |
-
|
| 1055 |
-
|
| 1056 |
-
|
| 1057 |
-
|
| 1058 |
-
|
| 1059 |
-
|
| 1060 |
-
|
| 1061 |
-
|
| 1062 |
-
|
| 1063 |
-
|
| 1064 |
-
|
| 1065 |
-
|
| 1066 |
-
|
| 1067 |
-
|
| 1068 |
-
|
| 1069 |
-
|
|
|
|
|
|
|
|
|
|
| 1070 |
""", unsafe_allow_html=True)
|
| 1071 |
-
|
|
|
|
| 1072 |
for item in items:
|
| 1073 |
st.markdown(f"""
|
| 1074 |
<div class="improvement-item">
|
| 1075 |
β’ {item}
|
| 1076 |
</div>
|
| 1077 |
""", unsafe_allow_html=True)
|
| 1078 |
-
|
| 1079 |
-
st.markdown("
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1080 |
|
| 1081 |
-
# Add additional CSS for
|
| 1082 |
st.markdown("""
|
| 1083 |
<style>
|
| 1084 |
-
.
|
| 1085 |
-
background:
|
| 1086 |
border-radius: 8px;
|
| 1087 |
padding: 20px;
|
| 1088 |
-
margin:
|
|
|
|
| 1089 |
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
| 1090 |
}
|
| 1091 |
|
| 1092 |
-
.
|
| 1093 |
-
display: flex;
|
| 1094 |
-
justify-content: space-between;
|
| 1095 |
-
align-items: center;
|
| 1096 |
-
margin-bottom: 15px;
|
| 1097 |
-
}
|
| 1098 |
-
|
| 1099 |
-
.category-name {
|
| 1100 |
-
font-size: 1.2em;
|
| 1101 |
-
font-weight: bold;
|
| 1102 |
color: #1f77b4;
|
|
|
|
| 1103 |
}
|
| 1104 |
|
| 1105 |
-
.
|
| 1106 |
-
padding: 5px 15px;
|
| 1107 |
-
border-radius: 15px;
|
| 1108 |
-
font-weight: bold;
|
| 1109 |
-
}
|
| 1110 |
-
|
| 1111 |
-
.score-pass {
|
| 1112 |
-
background-color: #28a745;
|
| 1113 |
-
color: white;
|
| 1114 |
-
}
|
| 1115 |
-
|
| 1116 |
-
.score-fail {
|
| 1117 |
-
background-color: #dc3545;
|
| 1118 |
-
color: white;
|
| 1119 |
-
}
|
| 1120 |
-
|
| 1121 |
-
.citations-container {
|
| 1122 |
-
margin-top: 10px;
|
| 1123 |
-
}
|
| 1124 |
-
|
| 1125 |
-
.citation-box {
|
| 1126 |
-
background: #f8f9fa;
|
| 1127 |
-
border-left: 3px solid #6c757d;
|
| 1128 |
-
padding: 10px;
|
| 1129 |
-
margin: 5px 0;
|
| 1130 |
-
border-radius: 0 4px 4px 0;
|
| 1131 |
-
}
|
| 1132 |
-
|
| 1133 |
-
.citation-text {
|
| 1134 |
color: #495057;
|
| 1135 |
-
|
| 1136 |
-
|
| 1137 |
-
.summary-card {
|
| 1138 |
-
background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
|
| 1139 |
-
border-radius: 8px;
|
| 1140 |
-
padding: 20px;
|
| 1141 |
-
margin: 15px 0;
|
| 1142 |
-
border-left: 4px solid #1f77b4;
|
| 1143 |
-
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
| 1144 |
}
|
| 1145 |
|
| 1146 |
.improvement-card {
|
|
@@ -1150,13 +1118,14 @@ def display_evaluation(evaluation: Dict[str, Any]):
|
|
| 1150 |
margin: 10px 0;
|
| 1151 |
height: 100%;
|
| 1152 |
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
|
|
| 1153 |
}
|
| 1154 |
|
| 1155 |
.improvement-card h5 {
|
| 1156 |
color: #1f77b4;
|
| 1157 |
-
margin-bottom:
|
|
|
|
| 1158 |
border-bottom: 2px solid #f0f0f0;
|
| 1159 |
-
padding-bottom: 5px;
|
| 1160 |
}
|
| 1161 |
|
| 1162 |
.improvement-list {
|
|
@@ -1164,12 +1133,22 @@ def display_evaluation(evaluation: Dict[str, Any]):
|
|
| 1164 |
}
|
| 1165 |
|
| 1166 |
.improvement-item {
|
| 1167 |
-
padding:
|
| 1168 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1169 |
}
|
| 1170 |
|
| 1171 |
-
.
|
| 1172 |
-
|
|
|
|
| 1173 |
}
|
| 1174 |
</style>
|
| 1175 |
""", unsafe_allow_html=True)
|
|
|
|
| 1026 |
if "summary" in recommendations:
|
| 1027 |
st.markdown("""
|
| 1028 |
<div class="summary-card">
|
| 1029 |
+
<h4>π Overall Assessment</h4>
|
| 1030 |
<div class="summary-content">
|
| 1031 |
+
{}
|
| 1032 |
+
</div>
|
| 1033 |
+
</div>
|
| 1034 |
+
""".format(recommendations["summary"]), unsafe_allow_html=True)
|
| 1035 |
|
| 1036 |
+
# Display improvements in categorized columns
|
| 1037 |
st.markdown("<h4>π‘ Areas for Improvement</h4>", unsafe_allow_html=True)
|
| 1038 |
improvements = recommendations.get("improvements", [])
|
| 1039 |
|
| 1040 |
+
# Initialize category buckets
|
| 1041 |
+
categorized_improvements = {
|
| 1042 |
+
"Communication": [],
|
| 1043 |
+
"Teaching": [],
|
| 1044 |
+
"Technical": []
|
| 1045 |
+
}
|
| 1046 |
+
|
| 1047 |
+
# Sort improvements into categories
|
| 1048 |
+
for improvement in improvements:
|
| 1049 |
+
if isinstance(improvement, dict):
|
| 1050 |
+
category = improvement.get("category", "").upper()
|
| 1051 |
+
message = improvement.get("message", "")
|
| 1052 |
+
|
| 1053 |
+
if "COMMUNICATION" in category:
|
| 1054 |
+
categorized_improvements["Communication"].append(message)
|
| 1055 |
+
elif "TEACHING" in category:
|
| 1056 |
+
categorized_improvements["Teaching"].append(message)
|
| 1057 |
+
elif "TECHNICAL" in category:
|
| 1058 |
+
categorized_improvements["Technical"].append(message)
|
| 1059 |
+
else:
|
| 1060 |
+
# Handle string improvements (legacy format)
|
| 1061 |
+
categorized_improvements["Technical"].append(str(improvement))
|
| 1062 |
+
|
| 1063 |
+
# Create columns for each category
|
| 1064 |
+
cols = st.columns(3)
|
| 1065 |
+
|
| 1066 |
+
# Display improvements in columns with icons
|
| 1067 |
+
for col, (category, items) in zip(cols, categorized_improvements.items()):
|
| 1068 |
+
with col:
|
| 1069 |
+
icon = "π£οΈ" if category == "Communication" else "π" if category == "Teaching" else "π»"
|
| 1070 |
+
st.markdown(f"""
|
| 1071 |
+
<div class="improvement-card">
|
| 1072 |
+
<h5>{icon} {category}</h5>
|
| 1073 |
+
<div class="improvement-list">
|
| 1074 |
""", unsafe_allow_html=True)
|
| 1075 |
+
|
| 1076 |
+
if items:
|
| 1077 |
for item in items:
|
| 1078 |
st.markdown(f"""
|
| 1079 |
<div class="improvement-item">
|
| 1080 |
β’ {item}
|
| 1081 |
</div>
|
| 1082 |
""", unsafe_allow_html=True)
|
| 1083 |
+
else:
|
| 1084 |
+
st.markdown("""
|
| 1085 |
+
<div class="improvement-item no-improvements">
|
| 1086 |
+
No specific improvements needed in this category.
|
| 1087 |
+
</div>
|
| 1088 |
+
""", unsafe_allow_html=True)
|
| 1089 |
+
|
| 1090 |
+
st.markdown("</div></div>", unsafe_allow_html=True)
|
| 1091 |
|
| 1092 |
+
# Add additional CSS for recommendations styling
|
| 1093 |
st.markdown("""
|
| 1094 |
<style>
|
| 1095 |
+
.summary-card {
|
| 1096 |
+
background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
|
| 1097 |
border-radius: 8px;
|
| 1098 |
padding: 20px;
|
| 1099 |
+
margin: 15px 0;
|
| 1100 |
+
border-left: 4px solid #1f77b4;
|
| 1101 |
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
| 1102 |
}
|
| 1103 |
|
| 1104 |
+
.summary-card h4 {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1105 |
color: #1f77b4;
|
| 1106 |
+
margin-bottom: 15px;
|
| 1107 |
}
|
| 1108 |
|
| 1109 |
+
.summary-content {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1110 |
color: #495057;
|
| 1111 |
+
line-height: 1.6;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1112 |
}
|
| 1113 |
|
| 1114 |
.improvement-card {
|
|
|
|
| 1118 |
margin: 10px 0;
|
| 1119 |
height: 100%;
|
| 1120 |
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
| 1121 |
+
border-left: 4px solid #28a745;
|
| 1122 |
}
|
| 1123 |
|
| 1124 |
.improvement-card h5 {
|
| 1125 |
color: #1f77b4;
|
| 1126 |
+
margin-bottom: 15px;
|
| 1127 |
+
padding-bottom: 10px;
|
| 1128 |
border-bottom: 2px solid #f0f0f0;
|
|
|
|
| 1129 |
}
|
| 1130 |
|
| 1131 |
.improvement-list {
|
|
|
|
| 1133 |
}
|
| 1134 |
|
| 1135 |
.improvement-item {
|
| 1136 |
+
padding: 8px;
|
| 1137 |
+
margin: 5px 0;
|
| 1138 |
+
background: #f8f9fa;
|
| 1139 |
+
border-radius: 4px;
|
| 1140 |
+
color: #495057;
|
| 1141 |
+
transition: transform 0.2s ease;
|
| 1142 |
+
}
|
| 1143 |
+
|
| 1144 |
+
.improvement-item:hover {
|
| 1145 |
+
transform: translateX(5px);
|
| 1146 |
+
background: #f0f0f0;
|
| 1147 |
}
|
| 1148 |
|
| 1149 |
+
.no-improvements {
|
| 1150 |
+
color: #6c757d;
|
| 1151 |
+
font-style: italic;
|
| 1152 |
}
|
| 1153 |
</style>
|
| 1154 |
""", unsafe_allow_html=True)
|