Update main.py
Browse files
main.py
CHANGED
@@ -1,93 +1,3 @@
|
|
1 |
-
# import streamlit as st
|
2 |
-
# from app_config import AppConfig # Import the configerations class
|
3 |
-
# from data_processor import DataProcessor # Import the data analysis class
|
4 |
-
# from visualization import Visualization # Import the data viz class
|
5 |
-
# from ai_analysis import AIAnalysis # Import the ai analysis class
|
6 |
-
# from sidebar import Sidebar # Import the Sidebar class
|
7 |
-
|
8 |
-
# def main():
|
9 |
-
# # Initialize the app configuration
|
10 |
-
# app_config = AppConfig()
|
11 |
-
|
12 |
-
# # Initialize the sidebar
|
13 |
-
# sidebar = Sidebar()
|
14 |
-
# sidebar.display()
|
15 |
-
|
16 |
-
# # Initialize the data processor
|
17 |
-
# data_processor = DataProcessor()
|
18 |
-
|
19 |
-
# # Initialize the visualization handler
|
20 |
-
# visualization = Visualization()
|
21 |
-
|
22 |
-
# # Initialize the AI analysis handler
|
23 |
-
# ai_analysis = AIAnalysis(data_processor.client)
|
24 |
-
|
25 |
-
# st.title("Intervention Program Analysis")
|
26 |
-
|
27 |
-
# # File uploader
|
28 |
-
# uploaded_file = st.file_uploader("Upload your Excel file", type=["xlsx"])
|
29 |
-
|
30 |
-
# if uploaded_file is not None:
|
31 |
-
# try:
|
32 |
-
# # Read the Excel file into a DataFrame
|
33 |
-
# df = data_processor.read_excel(uploaded_file)
|
34 |
-
|
35 |
-
# # Format the session data
|
36 |
-
# df = data_processor.format_session_data(df)
|
37 |
-
|
38 |
-
# # Replace student names with initials
|
39 |
-
# df = data_processor.replace_student_names_with_initials(df)
|
40 |
-
|
41 |
-
# st.subheader("Uploaded Data")
|
42 |
-
# st.write(df)
|
43 |
-
|
44 |
-
# # Ensure expected column is available
|
45 |
-
# if DataProcessor.INTERVENTION_COLUMN not in df.columns:
|
46 |
-
# st.error(f"Expected column '{DataProcessor.INTERVENTION_COLUMN}' not found.")
|
47 |
-
# return
|
48 |
-
|
49 |
-
# # Compute Intervention Session Statistics
|
50 |
-
# intervention_stats = data_processor.compute_intervention_statistics(df)
|
51 |
-
# st.subheader("Intervention Session Statistics")
|
52 |
-
# st.write(intervention_stats)
|
53 |
-
|
54 |
-
# # Plot and download intervention statistics
|
55 |
-
# intervention_fig = visualization.plot_intervention_statistics(intervention_stats)
|
56 |
-
# visualization.download_chart(intervention_fig, "intervention_statistics_chart.png")
|
57 |
-
|
58 |
-
# # Compute Student Metrics
|
59 |
-
# student_metrics_df = data_processor.compute_student_metrics(df)
|
60 |
-
# st.subheader("Student Metrics")
|
61 |
-
# st.write(student_metrics_df)
|
62 |
-
|
63 |
-
# # Compute Student Metric Averages
|
64 |
-
# attendance_avg_stats, engagement_avg_stats = data_processor.compute_average_metrics(student_metrics_df)
|
65 |
-
|
66 |
-
# # Plot and download student metrics
|
67 |
-
# student_metrics_fig = visualization.plot_student_metrics(student_metrics_df, attendance_avg_stats, engagement_avg_stats)
|
68 |
-
# visualization.download_chart(student_metrics_fig, "student_metrics_chart.png")
|
69 |
-
|
70 |
-
# # Prepare input for the language model
|
71 |
-
# llm_input = ai_analysis.prepare_llm_input(student_metrics_df)
|
72 |
-
|
73 |
-
# # Generate Notes and Recommendations using Hugging Face LLM
|
74 |
-
# with st.spinner("Generating AI analysis..."):
|
75 |
-
# recommendations = ai_analysis.prompt_response_from_hf_llm(llm_input)
|
76 |
-
|
77 |
-
# st.subheader("AI Analysis")
|
78 |
-
# st.markdown(recommendations)
|
79 |
-
|
80 |
-
# # Download AI output
|
81 |
-
# ai_analysis.download_llm_output(recommendations, "llm_output.txt")
|
82 |
-
|
83 |
-
# except Exception as e:
|
84 |
-
# st.error(f"Error reading the file: {str(e)}")
|
85 |
-
|
86 |
-
# if __name__ == '__main__':
|
87 |
-
# main()
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
import streamlit as st
|
92 |
from app_config import AppConfig # Import the configurations class
|
93 |
from data_processor import DataProcessor # Import the data analysis class
|
@@ -142,9 +52,24 @@ def main():
|
|
142 |
st.write(intervention_stats)
|
143 |
|
144 |
# Plot and download intervention statistics
|
145 |
-
intervention_fig = visualization.plot_intervention_statistics(intervention_stats)
|
146 |
-
visualization.download_chart(intervention_fig, "intervention_statistics_chart.png")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
|
|
|
|
|
148 |
# Compute Student Metrics
|
149 |
student_metrics_df = data_processor.compute_student_metrics(df)
|
150 |
st.subheader("Student Metrics")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
from app_config import AppConfig # Import the configurations class
|
3 |
from data_processor import DataProcessor # Import the data analysis class
|
|
|
52 |
st.write(intervention_stats)
|
53 |
|
54 |
# Plot and download intervention statistics
|
55 |
+
# intervention_fig = visualization.plot_intervention_statistics(intervention_stats)
|
56 |
+
# visualization.download_chart(intervention_fig, "intervention_statistics_chart.png")
|
57 |
+
|
58 |
+
# Plot and download intervention statistics: Two-column layout for the visualization and intervention frequency
|
59 |
+
col1, col2 = st.columns([3, 1]) # Set the column width ratio
|
60 |
+
|
61 |
+
with col1:
|
62 |
+
intervention_fig = plot_intervention_statistics(intervention_stats)
|
63 |
+
|
64 |
+
with col2:
|
65 |
+
intervention_frequency = intervention_stats['Intervention Frequency (%)'].values[0]
|
66 |
+
# Display the "Intervention Frequency (%)" text
|
67 |
+
st.markdown("<h3 style='color: #358E66;'>Intervention Frequency</h3>", unsafe_allow_html=True)
|
68 |
+
# Display the frequency value below it
|
69 |
+
st.markdown(f"<h1 style='color: #358E66;'>{intervention_frequency}%</h1>", unsafe_allow_html=True)
|
70 |
|
71 |
+
visualization.download_chart(intervention_fig, "intervention_statistics_chart.png")
|
72 |
+
|
73 |
# Compute Student Metrics
|
74 |
student_metrics_df = data_processor.compute_student_metrics(df)
|
75 |
st.subheader("Student Metrics")
|