sparshmehta commited on
Commit
f54e6c4
Β·
verified Β·
1 Parent(s): 216875f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +76 -97
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 Summary</h4>
1030
  <div class="summary-content">
1031
- """, unsafe_allow_html=True)
1032
- st.markdown(recommendations["summary"])
1033
- st.markdown("</div></div>", unsafe_allow_html=True)
 
1034
 
1035
- # Display improvements using categories from content analysis
1036
  st.markdown("<h4>πŸ’‘ Areas for Improvement</h4>", unsafe_allow_html=True)
1037
  improvements = recommendations.get("improvements", [])
1038
 
1039
- if isinstance(improvements, list):
1040
- # Use predefined categories
1041
- categories = {
1042
- "πŸ—£οΈ Communication": [],
1043
- "πŸ“š Teaching": [],
1044
- "πŸ’» Technical": []
1045
- }
1046
-
1047
- # Each improvement should now come with a category from the content analysis
1048
- for improvement in improvements:
1049
- if isinstance(improvement, dict):
1050
- category = improvement.get("category", "πŸ’» Technical") # Default to Technical if no category
1051
- message = improvement.get("message", str(improvement))
1052
- if "COMMUNICATION" in category.upper():
1053
- categories["πŸ—£οΈ Communication"].append(message)
1054
- elif "TEACHING" in category.upper():
1055
- categories["πŸ“š Teaching"].append(message)
1056
- elif "TECHNICAL" in category.upper():
1057
- categories["πŸ’» Technical"].append(message)
1058
- else:
1059
- # Handle legacy format or plain strings
1060
- categories["πŸ’» Technical"].append(improvement)
1061
-
1062
- # Display categorized improvements in columns
1063
- cols = st.columns(len(categories))
1064
- for col, (category, items) in zip(cols, categories.items()):
1065
- with col:
1066
- st.markdown(f"""
1067
- <div class="improvement-card">
1068
- <h5>{category}</h5>
1069
- <div class="improvement-list">
 
 
 
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("</div></div>", unsafe_allow_html=True)
 
 
 
 
 
 
1080
 
1081
- # Add additional CSS for new components
1082
  st.markdown("""
1083
  <style>
1084
- .teaching-card {
1085
- background: white;
1086
  border-radius: 8px;
1087
  padding: 20px;
1088
- margin: 10px 0;
 
1089
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
1090
  }
1091
 
1092
- .teaching-header {
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
- .score-badge {
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: 10px;
 
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: 5px 0;
1168
- border-bottom: 1px solid #f0f0f0;
 
 
 
 
 
 
 
 
 
1169
  }
1170
 
1171
- .improvement-item:last-child {
1172
- border-bottom: none;
 
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)