sparshmehta commited on
Commit
767088e
·
verified ·
1 Parent(s): c32ce33

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -13
app.py CHANGED
@@ -1089,27 +1089,32 @@ def display_evaluation(evaluation: Dict[str, Any]):
1089
 
1090
  st.markdown("---")
1091
 
1092
- # Summary Section
1093
  st.subheader("Teaching Summary")
1094
  col1, col2, col3 = st.columns(3)
1095
 
1096
  with col1:
 
1097
  concept_scores = [
1098
  assessment.get("Score", 0)
1099
- for assessment in concept_assessment.values()
 
1100
  ]
1101
  concept_score = (sum(concept_scores) / len(concept_scores) * 100) if concept_scores else 0
1102
  st.metric("Concept Score", f"{concept_score:.1f}%")
1103
 
1104
  with col2:
 
1105
  code_scores = [
1106
  assessment.get("Score", 0)
1107
- for assessment in code_assessment.values()
 
1108
  ]
1109
  code_score = (sum(code_scores) / len(code_scores) * 100) if code_scores else 0
1110
  st.metric("Code Score", f"{code_score:.1f}%")
1111
 
1112
  with col3:
 
1113
  total_scores = concept_scores + code_scores
1114
  overall_score = (sum(total_scores) / len(total_scores) * 100) if total_scores else 0
1115
  st.metric("Overall Teaching Score", f"{overall_score:.1f}%")
@@ -1190,21 +1195,26 @@ def display_evaluation(evaluation: Dict[str, Any]):
1190
  col1, col2, col3 = st.columns(3)
1191
 
1192
  with col1:
1193
- # Calculate teaching score
1194
  teaching_data = evaluation.get("teaching", {})
 
 
 
 
1195
  concept_scores = [
1196
- teaching_data.get(cat, {}).get("score", 0)
1197
- for cat in ["subjectMatterAccuracy", "firstPrinciplesApproach",
1198
- "examplesAndContext", "cohesiveStorytelling",
1199
- "engagementAndInteraction", "professionalTone"]
1200
  ]
 
 
1201
  code_scores = [
1202
- teaching_data.get(cat, {}).get("score", 0)
1203
- for cat in ["depthOfExplanation", "outputInterpretation", "breakingDownComplexity"]
1204
  ]
1205
 
1206
- all_scores = concept_scores + code_scores
1207
- teaching_score = (sum(all_scores) / len(all_scores)) * 100 if all_scores else 0
 
1208
  st.metric("Teaching Score", f"{teaching_score:.1f}%")
1209
 
1210
  with col2:
@@ -1215,7 +1225,7 @@ def display_evaluation(evaluation: Dict[str, Any]):
1215
  communication.get(cat, {}).get("score", 0)
1216
  for cat in comm_categories
1217
  ]
1218
- comm_score = (sum(comm_scores) / len(comm_scores)) * 100 if comm_scores else 0
1219
  st.metric("Communication Score", f"{comm_score:.1f}%")
1220
 
1221
  with col3:
 
1089
 
1090
  st.markdown("---")
1091
 
1092
+ # Teaching Summary Section
1093
  st.subheader("Teaching Summary")
1094
  col1, col2, col3 = st.columns(3)
1095
 
1096
  with col1:
1097
+ # Calculate concept scores
1098
  concept_scores = [
1099
  assessment.get("Score", 0)
1100
+ for category in concept_assessment.values()
1101
+ for assessment in [category]
1102
  ]
1103
  concept_score = (sum(concept_scores) / len(concept_scores) * 100) if concept_scores else 0
1104
  st.metric("Concept Score", f"{concept_score:.1f}%")
1105
 
1106
  with col2:
1107
+ # Calculate code scores
1108
  code_scores = [
1109
  assessment.get("Score", 0)
1110
+ for category in code_assessment.values()
1111
+ for assessment in [category]
1112
  ]
1113
  code_score = (sum(code_scores) / len(code_scores) * 100) if code_scores else 0
1114
  st.metric("Code Score", f"{code_score:.1f}%")
1115
 
1116
  with col3:
1117
+ # Calculate overall teaching score
1118
  total_scores = concept_scores + code_scores
1119
  overall_score = (sum(total_scores) / len(total_scores) * 100) if total_scores else 0
1120
  st.metric("Overall Teaching Score", f"{overall_score:.1f}%")
 
1195
  col1, col2, col3 = st.columns(3)
1196
 
1197
  with col1:
1198
+ # Calculate teaching score correctly from the teaching data
1199
  teaching_data = evaluation.get("teaching", {})
1200
+ concept_assessment = teaching_data.get("Concept Assessment", {})
1201
+ code_assessment = teaching_data.get("Code Assessment", {})
1202
+
1203
+ # Calculate concept scores
1204
  concept_scores = [
1205
+ category.get("Score", 0)
1206
+ for category in concept_assessment.values()
 
 
1207
  ]
1208
+
1209
+ # Calculate code scores
1210
  code_scores = [
1211
+ category.get("Score", 0)
1212
+ for category in code_assessment.values()
1213
  ]
1214
 
1215
+ # Calculate overall teaching score
1216
+ all_teaching_scores = concept_scores + code_scores
1217
+ teaching_score = (sum(all_teaching_scores) / len(all_teaching_scores) * 100) if all_teaching_scores else 0
1218
  st.metric("Teaching Score", f"{teaching_score:.1f}%")
1219
 
1220
  with col2:
 
1225
  communication.get(cat, {}).get("score", 0)
1226
  for cat in comm_categories
1227
  ]
1228
+ comm_score = (sum(comm_scores) / len(comm_scores) * 100) if comm_scores else 0
1229
  st.metric("Communication Score", f"{comm_score:.1f}%")
1230
 
1231
  with col3: