ibrahim313 commited on
Commit
4e0d894
·
verified ·
1 Parent(s): 7fd2fab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +85 -87
app.py CHANGED
@@ -65,19 +65,16 @@ st.set_page_config(page_title="EduNexus", page_icon=":book:", layout="wide")
65
  st.markdown("""
66
  <style>
67
  body {
68
- background-color: #1e1e2d;
69
- color: #e0e0e0;
70
  }
71
  .css-1o7k8tt {
72
- background-color: #2f2f6f;
73
- color: #ffffff;
74
- }
75
- .css-1o7k8tt h1 {
76
- color: #d6a4a0;
77
  }
78
  .stButton {
79
- background-color: #d6a4a0;
80
- color: #ffffff;
81
  border-radius: 12px;
82
  padding: 12px 24px;
83
  font-size: 16px;
@@ -85,43 +82,43 @@ st.markdown("""
85
  transition: background-color 0.3s, box-shadow 0.3s;
86
  }
87
  .stButton:hover {
88
- background-color: #b35b5b;
89
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
90
  }
91
  .stTextInput, .stTextArea {
92
- border: 1px solid #d6a4a0;
93
  border-radius: 12px;
94
- background-color: #2f2f4f;
95
- color: #ffffff;
96
  }
97
  .stTextInput::placeholder, .stTextArea::placeholder {
98
- color: #a0a0a0;
99
  }
100
  .stSidebar {
101
- background-color: #3e3e5f;
 
102
  }
103
  .stSidebar .stMarkdown {
104
- color: #ffffff;
105
  }
106
  .footer {
107
- background-color: #2e2e3e;
108
  padding: 15px;
109
  text-align: center;
110
- color: #ffffff;
111
- border-top: 1px solid #d6a4a0;
112
  position: fixed;
113
  bottom: 0;
114
  width: 100%;
115
- box-shadow: 0 -6px 12px rgba(0, 0, 0, 0.4);
116
  }
117
  .footer a {
118
- color: #d6a4a0;
119
  margin: 0 15px;
120
  text-decoration: none;
121
  font-size: 18px;
122
  }
123
  .footer a:hover {
124
- color: #ffffff;
125
  }
126
  .footer i {
127
  font-size: 22px;
@@ -129,72 +126,73 @@ st.markdown("""
129
  </style>
130
  """, unsafe_allow_html=True)
131
 
132
- # Define function to clear all inputs
133
- def clear_chat():
134
- st.session_state['responses'] = {
135
- "personalized_learning_assistant": "",
136
- "ai_coding_mentor": "",
137
- "smart_document_summarizer": "",
138
- "interactive_study_planner": "",
139
- "real_time_qa_support": "",
140
- "mental_health_check_in": ""
141
- }
142
-
143
- # Initialize layout for buttons
144
- def display_response(response_key, response):
145
- st.write(response)
146
- col1, col2 = st.columns([4, 1])
147
- with col1:
148
- st.download_button(
149
- "Download Response",
150
- response,
151
- file_name=f"{response_key}.txt"
152
- )
153
- with col2:
154
- if st.button("Clear", key=f"clear_{response_key}"):
155
- st.session_state['responses'][response_key] = "" # Clear the response for the specific tool
156
-
157
- # Initialize layout for form
158
- def display_tool_form(tool_key, submit_function, placeholder):
159
- with st.form(key=f"{tool_key}_form"):
160
- input_text = st.text_area(f"Enter your {tool_key.replace('_', ' ')}", placeholder=placeholder)
161
- col1, col2 = st.columns([3, 1])
162
- with col1:
163
- submit_button = st.form_submit_button("Get Explanation")
164
- with col2:
165
- clear_button = st.form_submit_button("Clear")
166
  if submit_button:
167
- response = submit_function(input_text)
168
- st.session_state['responses'][tool_key] = response
169
- if clear_button:
170
- st.session_state['responses'][tool_key] = ""
171
-
172
- st.title("EduNexus: Your Academic Assistant")
173
-
174
- # Display forms for each tool
175
- st.header("1. Personalized Learning Assistant")
176
- display_tool_form("personalized_learning_assistant", personalized_learning_assistant, "Enter the topic you want to learn about...")
177
-
178
- st.header("2. AI Coding Mentor")
179
- display_tool_form("ai_coding_mentor", ai_coding_mentor, "Paste your code snippet here...")
180
-
181
- st.header("3. Smart Document Summarizer")
182
- display_tool_form("smart_document_summarizer", smart_document_summarizer, "Paste your document text here...")
183
-
184
- st.header("4. Interactive Study Planner")
185
- display_tool_form("interactive_study_planner", interactive_study_planner, "Enter your exam schedule here...")
186
-
187
- st.header("5. Real-Time Q&A Support")
188
- display_tool_form("real_time_qa_support", real_time_qa_support, "Ask your academic question here...")
189
-
190
- st.header("6. Mental Health Check-In")
191
- display_tool_form("mental_health_check_in", mental_health_check_in, "Share how you are feeling today...")
192
-
193
- # Display responses
194
- st.write("### Responses")
195
- for key, response in st.session_state['responses'].items():
196
- if response:
197
- display_response(key, response)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
 
199
  # Footer
200
  st.markdown("""
 
65
  st.markdown("""
66
  <style>
67
  body {
68
+ background-color: #000000; /* Royal Black */
69
+ color: #ffffff; /* White */
70
  }
71
  .css-1o7k8tt {
72
+ background-color: #000000; /* Royal Black */
73
+ color: #ffffff; /* White */
 
 
 
74
  }
75
  .stButton {
76
+ background-color: #ffffff; /* White */
77
+ color: #000000; /* Royal Black */
78
  border-radius: 12px;
79
  padding: 12px 24px;
80
  font-size: 16px;
 
82
  transition: background-color 0.3s, box-shadow 0.3s;
83
  }
84
  .stButton:hover {
85
+ background-color: #d3d3d3; /* Light Gray */
86
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
87
  }
88
  .stTextInput, .stTextArea {
89
+ border: 1px solid #ffffff; /* White */
90
  border-radius: 12px;
91
+ background-color: #000000; /* Royal Black */
92
+ color: #ffffff; /* White */
93
  }
94
  .stTextInput::placeholder, .stTextArea::placeholder {
95
+ color: #a0a0a0; /* Gray */
96
  }
97
  .stSidebar {
98
+ background-color: #000000; /* Royal Black */
99
+ color: #ffffff; /* White */
100
  }
101
  .stSidebar .stMarkdown {
102
+ color: #ffffff; /* White */
103
  }
104
  .footer {
105
+ background-color: #000000; /* Royal Black */
106
  padding: 15px;
107
  text-align: center;
108
+ color: #ffffff; /* White */
109
+ border-top: 1px solid #ffffff; /* White */
110
  position: fixed;
111
  bottom: 0;
112
  width: 100%;
 
113
  }
114
  .footer a {
115
+ color: #ffffff; /* White */
116
  margin: 0 15px;
117
  text-decoration: none;
118
  font-size: 18px;
119
  }
120
  .footer a:hover {
121
+ color: #d3d3d3; /* Light Gray */
122
  }
123
  .footer i {
124
  font-size: 22px;
 
126
  </style>
127
  """, unsafe_allow_html=True)
128
 
129
+ # Sidebar with tasks
130
+ st.sidebar.title("Tasks")
131
+ tasks = [
132
+ "Personalized Learning Assistant",
133
+ "AI Coding Mentor",
134
+ "Smart Document Summarizer",
135
+ "Interactive Study Planner",
136
+ "Real-Time Q&A Support",
137
+ "Mental Health Check-In"
138
+ ]
139
+
140
+ selected_task = st.sidebar.radio("Select a task", tasks)
141
+
142
+ # Main layout based on selected task
143
+ if selected_task == "Personalized Learning Assistant":
144
+ st.header("Personalized Learning Assistant")
145
+ with st.form(key="personalized_learning_assistant_form"):
146
+ topic = st.text_area("Enter the topic you want to learn about")
147
+ submit_button = st.form_submit_button("Get Explanation")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  if submit_button:
149
+ response = personalized_learning_assistant(topic)
150
+ st.write(response)
151
+
152
+ elif selected_task == "AI Coding Mentor":
153
+ st.header("AI Coding Mentor")
154
+ with st.form(key="ai_coding_mentor_form"):
155
+ code_snippet = st.text_area("Paste your code snippet here")
156
+ submit_button = st.form_submit_button("Get Review")
157
+ if submit_button:
158
+ response = ai_coding_mentor(code_snippet)
159
+ st.write(response)
160
+
161
+ elif selected_task == "Smart Document Summarizer":
162
+ st.header("Smart Document Summarizer")
163
+ with st.form(key="smart_document_summarizer_form"):
164
+ document_text = st.text_area("Paste your document text here")
165
+ submit_button = st.form_submit_button("Get Summary")
166
+ if submit_button:
167
+ response = smart_document_summarizer(document_text)
168
+ st.write(response)
169
+
170
+ elif selected_task == "Interactive Study Planner":
171
+ st.header("Interactive Study Planner")
172
+ with st.form(key="interactive_study_planner_form"):
173
+ exam_schedule = st.text_area("Enter your exam schedule here")
174
+ submit_button = st.form_submit_button("Create Study Plan")
175
+ if submit_button:
176
+ response = interactive_study_planner(exam_schedule)
177
+ st.write(response)
178
+
179
+ elif selected_task == "Real-Time Q&A Support":
180
+ st.header("Real-Time Q&A Support")
181
+ with st.form(key="real_time_qa_support_form"):
182
+ question = st.text_area("Ask your academic question here")
183
+ submit_button = st.form_submit_button("Get Answer")
184
+ if submit_button:
185
+ response = real_time_qa_support(question)
186
+ st.write(response)
187
+
188
+ elif selected_task == "Mental Health Check-In":
189
+ st.header("Mental Health Check-In")
190
+ with st.form(key="mental_health_check_in_form"):
191
+ feelings = st.text_area("Share how you are feeling today")
192
+ submit_button = st.form_submit_button("Get Advice")
193
+ if submit_button:
194
+ response = mental_health_check_in(feelings)
195
+ st.write(response)
196
 
197
  # Footer
198
  st.markdown("""