ProfessorLeVesseur commited on
Commit
e4df3ae
1 Parent(s): 493a1c3

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +16 -3
main.py CHANGED
@@ -88,14 +88,27 @@ def main():
88
  )
89
  st.subheader("Student Evaluations")
90
  st.write(student_metrics_df[['Student', 'Evaluation']])
91
-
92
- st.table(student_metrics_df[['Student', 'Evaluation']])
93
 
94
  # Build and display decision tree diagrams for each student
95
  for index, row in student_metrics_df.iterrows():
96
  tree_diagram = visualization.build_tree_diagram(row)
97
  st.graphviz_chart(tree_diagram.source)
98
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  # Prepare input for the language model
100
  llm_input = ai_analysis.prepare_llm_input(student_metrics_df)
101
 
 
88
  )
89
  st.subheader("Student Evaluations")
90
  st.write(student_metrics_df[['Student', 'Evaluation']])
 
 
91
 
92
  # Build and display decision tree diagrams for each student
93
  for index, row in student_metrics_df.iterrows():
94
  tree_diagram = visualization.build_tree_diagram(row)
95
  st.graphviz_chart(tree_diagram.source)
96
+
97
+ # Render and prepare the diagram for download
98
+ filename = f"{row['Student']}_decision_tree"
99
+ filepath = download_tree_diagram(tree_diagram, filename)
100
+
101
+ # Provide a download button
102
+ with open(filepath, "rb") as file:
103
+ st.download_button(
104
+ label=f"Download {row['Student']}'s Diagram",
105
+ data=file.read(),
106
+ file_name=f"{filename}.png",
107
+ mime="image/png",
108
+ icon="↹",
109
+ use_container_width=True
110
+ )
111
+
112
  # Prepare input for the language model
113
  llm_input = ai_analysis.prepare_llm_input(student_metrics_df)
114