ibrahim313 commited on
Commit
a16cf0b
·
verified ·
1 Parent(s): 8ac0518

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -33
app.py CHANGED
@@ -178,13 +178,6 @@ def display_response(response_key, response):
178
  file_name=f"{response_key}.txt"
179
  )
180
 
181
- # Function to handle image uploads
182
- def upload_image():
183
- st.header("Image Upload")
184
- image = st.file_uploader("Choose an image", type=["png", "jpg", "jpeg"])
185
- if image is not None:
186
- st.image(image, caption="Uploaded Image", use_column_width=True)
187
-
188
  if selected_tool == "Personalized Learning Assistant":
189
  st.header("Personalized Learning Assistant")
190
  with st.form(key="learning_form"):
@@ -195,74 +188,68 @@ if selected_tool == "Personalized Learning Assistant":
195
  st.session_state['responses']['personalized_learning_assistant'] = explanation
196
  if st.session_state['responses']['personalized_learning_assistant']:
197
  display_response("personalized_learning_assistant", st.session_state['responses']['personalized_learning_assistant'])
198
- upload_image()
199
 
200
  elif selected_tool == "AI Coding Mentor":
201
  st.header("AI Coding Mentor")
202
  with st.form(key="coding_form"):
203
- code_input = st.text_area("Paste your code snippet", placeholder="e.g., for i in range(10): print(i)")
204
- submit_button = st.form_submit_button("Get Review")
205
  if submit_button:
206
  review = ai_coding_mentor(code_input)
207
  st.session_state['responses']['ai_coding_mentor'] = review
208
  if st.session_state['responses']['ai_coding_mentor']:
209
  display_response("ai_coding_mentor", st.session_state['responses']['ai_coding_mentor'])
210
- upload_image()
211
 
212
  elif selected_tool == "Smart Document Summarizer":
213
  st.header("Smart Document Summarizer")
214
- with st.form(key="summary_form"):
215
- document_input = st.text_area("Paste your document text", placeholder="e.g., Quantum computing is...")
216
- submit_button = st.form_submit_button("Get Summary")
217
  if submit_button:
218
  summary = smart_document_summarizer(document_input)
219
  st.session_state['responses']['smart_document_summarizer'] = summary
220
  if st.session_state['responses']['smart_document_summarizer']:
221
  display_response("smart_document_summarizer", st.session_state['responses']['smart_document_summarizer'])
222
- upload_image()
223
 
224
  elif selected_tool == "Interactive Study Planner":
225
  st.header("Interactive Study Planner")
226
- with st.form(key="study_form"):
227
- exam_input = st.text_area("Enter your exam schedule", placeholder="e.g., Exam 1: Math - 10th Oct, Exam 2: Physics - 12th Oct")
228
- submit_button = st.form_submit_button("Generate Study Plan")
229
  if submit_button:
230
- study_plan = interactive_study_planner(exam_input)
231
  st.session_state['responses']['interactive_study_planner'] = study_plan
232
  if st.session_state['responses']['interactive_study_planner']:
233
  display_response("interactive_study_planner", st.session_state['responses']['interactive_study_planner'])
234
- upload_image()
235
 
236
  elif selected_tool == "Real-Time Q&A Support":
237
  st.header("Real-Time Q&A Support")
238
  with st.form(key="qa_form"):
239
- question_input = st.text_area("Enter your academic question", placeholder="e.g., What is Newton's third law?")
240
  submit_button = st.form_submit_button("Get Answer")
241
  if submit_button:
242
  answer = real_time_qa_support(question_input)
243
  st.session_state['responses']['real_time_qa_support'] = answer
244
  if st.session_state['responses']['real_time_qa_support']:
245
  display_response("real_time_qa_support", st.session_state['responses']['real_time_qa_support'])
246
- upload_image()
247
 
248
  elif selected_tool == "Mental Health Check-In":
249
  st.header("Mental Health Check-In")
250
- with st.form(key="health_form"):
251
- feeling_input = st.text_area("Describe how you're feeling", placeholder="e.g., Feeling anxious about exams")
252
  submit_button = st.form_submit_button("Get Advice")
253
  if submit_button:
254
- advice = mental_health_check_in(feeling_input)
255
  st.session_state['responses']['mental_health_check_in'] = advice
256
  if st.session_state['responses']['mental_health_check_in']:
257
  display_response("mental_health_check_in", st.session_state['responses']['mental_health_check_in'])
258
- upload_image()
259
 
260
- # Footer with social media links
261
  st.markdown("""
262
- <div class="footer">
263
- <p>Connect with us on social media:</p>
264
- <a href="https://www.facebook.com" target="_blank"><i class="fab fa-facebook"></i> Facebook</a>
265
- <a href="https://www.twitter.com" target="_blank"><i class="fab fa-twitter"></i> Twitter</a>
266
- <a href="https://www.linkedin.com" target="_blank"><i class="fab fa-linkedin"></i> LinkedIn</a>
267
- </div>
268
  """, unsafe_allow_html=True)
 
178
  file_name=f"{response_key}.txt"
179
  )
180
 
 
 
 
 
 
 
 
181
  if selected_tool == "Personalized Learning Assistant":
182
  st.header("Personalized Learning Assistant")
183
  with st.form(key="learning_form"):
 
188
  st.session_state['responses']['personalized_learning_assistant'] = explanation
189
  if st.session_state['responses']['personalized_learning_assistant']:
190
  display_response("personalized_learning_assistant", st.session_state['responses']['personalized_learning_assistant'])
 
191
 
192
  elif selected_tool == "AI Coding Mentor":
193
  st.header("AI Coding Mentor")
194
  with st.form(key="coding_form"):
195
+ code_input = st.text_area("Enter your code snippet", placeholder="e.g., def add(a, b): return a + b")
196
+ submit_button = st.form_submit_button("Review Code")
197
  if submit_button:
198
  review = ai_coding_mentor(code_input)
199
  st.session_state['responses']['ai_coding_mentor'] = review
200
  if st.session_state['responses']['ai_coding_mentor']:
201
  display_response("ai_coding_mentor", st.session_state['responses']['ai_coding_mentor'])
 
202
 
203
  elif selected_tool == "Smart Document Summarizer":
204
  st.header("Smart Document Summarizer")
205
+ with st.form(key="summarizer_form"):
206
+ document_input = st.text_area("Paste your document text here", placeholder="e.g., The rise of electric vehicles...")
207
+ submit_button = st.form_submit_button("Summarize Document")
208
  if submit_button:
209
  summary = smart_document_summarizer(document_input)
210
  st.session_state['responses']['smart_document_summarizer'] = summary
211
  if st.session_state['responses']['smart_document_summarizer']:
212
  display_response("smart_document_summarizer", st.session_state['responses']['smart_document_summarizer'])
 
213
 
214
  elif selected_tool == "Interactive Study Planner":
215
  st.header("Interactive Study Planner")
216
+ with st.form(key="planner_form"):
217
+ schedule_input = st.text_area("Enter your exam schedule", placeholder="e.g., 3 exams in one week")
218
+ submit_button = st.form_submit_button("Create Study Plan")
219
  if submit_button:
220
+ study_plan = interactive_study_planner(schedule_input)
221
  st.session_state['responses']['interactive_study_planner'] = study_plan
222
  if st.session_state['responses']['interactive_study_planner']:
223
  display_response("interactive_study_planner", st.session_state['responses']['interactive_study_planner'])
 
224
 
225
  elif selected_tool == "Real-Time Q&A Support":
226
  st.header("Real-Time Q&A Support")
227
  with st.form(key="qa_form"):
228
+ question_input = st.text_input("Ask a question", placeholder="e.g., What is Newton's third law?")
229
  submit_button = st.form_submit_button("Get Answer")
230
  if submit_button:
231
  answer = real_time_qa_support(question_input)
232
  st.session_state['responses']['real_time_qa_support'] = answer
233
  if st.session_state['responses']['real_time_qa_support']:
234
  display_response("real_time_qa_support", st.session_state['responses']['real_time_qa_support'])
 
235
 
236
  elif selected_tool == "Mental Health Check-In":
237
  st.header("Mental Health Check-In")
238
+ with st.form(key="mental_health_form"):
239
+ feelings_input = st.text_area("How are you feeling today?", placeholder="e.g., Stressed about exams")
240
  submit_button = st.form_submit_button("Get Advice")
241
  if submit_button:
242
+ advice = mental_health_check_in(feelings_input)
243
  st.session_state['responses']['mental_health_check_in'] = advice
244
  if st.session_state['responses']['mental_health_check_in']:
245
  display_response("mental_health_check_in", st.session_state['responses']['mental_health_check_in'])
 
246
 
247
+ # Add footer with contact information
248
  st.markdown("""
249
+ <div class="footer">
250
+ <p>Powered by EduNexus</p>
251
+ <a href="https://twitter.com/yourhandle" target="_blank"><i class="fab fa-twitter"></i></a>
252
+ <a href="https://linkedin.com/in/yourprofile" target="_blank"><i class="fab fa-linkedin"></i></a>
253
+ <a href="mailto:your.email@example.com"><i class="fas fa-envelope"></i></a>
254
+ </div>
255
  """, unsafe_allow_html=True)