Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,17 +1,17 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import os
|
| 3 |
from groq import Groq
|
| 4 |
-
from streamlit.components.v1 import html
|
| 5 |
import random
|
| 6 |
-
|
| 7 |
# Set up page configuration
|
| 8 |
st.set_page_config(page_title="EduNexus 🚀", page_icon="🚀", layout="wide")
|
| 9 |
-
|
|
|
|
| 10 |
api_key = st.secrets["GROQ_API_KEY"]
|
| 11 |
client = Groq(api_key=api_key)
|
| 12 |
|
| 13 |
-
# Define the LLaMA model
|
| 14 |
-
MODEL_NAME = "llama3-8b-8192"
|
| 15 |
|
| 16 |
# Function to call Groq API
|
| 17 |
def call_groq_api(prompt):
|
|
@@ -24,26 +24,32 @@ def call_groq_api(prompt):
|
|
| 24 |
except Exception as e:
|
| 25 |
return f"Error: {str(e)}"
|
| 26 |
|
| 27 |
-
# Define
|
| 28 |
def personalized_learning_assistant(topic):
|
| 29 |
-
|
|
|
|
| 30 |
|
| 31 |
def ai_coding_mentor(code_snippet):
|
| 32 |
-
|
|
|
|
| 33 |
|
| 34 |
def smart_document_summarizer(document_text):
|
| 35 |
-
|
|
|
|
| 36 |
|
| 37 |
def interactive_study_planner(exam_schedule):
|
| 38 |
-
|
|
|
|
| 39 |
|
| 40 |
def real_time_qa_support(question):
|
| 41 |
-
|
|
|
|
| 42 |
|
| 43 |
def mental_health_check_in(feelings):
|
| 44 |
-
|
|
|
|
| 45 |
|
| 46 |
-
# Initialize session state
|
| 47 |
if 'responses' not in st.session_state:
|
| 48 |
st.session_state['responses'] = {
|
| 49 |
"personalized_learning_assistant": "",
|
|
@@ -54,340 +60,137 @@ if 'responses' not in st.session_state:
|
|
| 54 |
"mental_health_check_in": ""
|
| 55 |
}
|
| 56 |
|
| 57 |
-
# Function to clear session state
|
| 58 |
-
def
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
.
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
.footer a:hover {
|
| 146 |
-
color: #4ECDC4;
|
| 147 |
-
}
|
| 148 |
-
|
| 149 |
-
/* Animated background */
|
| 150 |
-
@keyframes gradientBG {
|
| 151 |
-
0% {background-position: 0% 50%;}
|
| 152 |
-
50% {background-position: 100% 50%;}
|
| 153 |
-
100% {background-position: 0% 50%;}
|
| 154 |
-
}
|
| 155 |
-
|
| 156 |
-
body::before {
|
| 157 |
-
content: "";
|
| 158 |
-
position: fixed;
|
| 159 |
-
top: 0;
|
| 160 |
-
left: 0;
|
| 161 |
-
width: 100%;
|
| 162 |
-
height: 100%;
|
| 163 |
-
background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
|
| 164 |
-
background-size: 400% 400%;
|
| 165 |
-
animation: gradientBG 15s ease infinite;
|
| 166 |
-
z-index: -1;
|
| 167 |
-
}
|
| 168 |
-
|
| 169 |
-
/* 3D Card Effect */
|
| 170 |
-
.tool-card {
|
| 171 |
-
background-color: rgba(255, 255, 255, 0.1);
|
| 172 |
-
border-radius: 20px;
|
| 173 |
-
padding: 1.5rem;
|
| 174 |
-
margin-bottom: 1rem;
|
| 175 |
-
transition: all 0.3s ease;
|
| 176 |
-
transform: perspective(1000px) rotateX(0deg) rotateY(0deg);
|
| 177 |
-
box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
|
| 178 |
-
}
|
| 179 |
-
|
| 180 |
-
.tool-card:hover {
|
| 181 |
-
transform: perspective(1000px) rotateX(10deg) rotateY(10deg);
|
| 182 |
-
box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
|
| 183 |
-
}
|
| 184 |
-
|
| 185 |
-
/* Emoji styles */
|
| 186 |
-
.emoji {
|
| 187 |
-
font-size: 2rem;
|
| 188 |
-
margin-right: 0.5rem;
|
| 189 |
-
}
|
| 190 |
-
</style>
|
| 191 |
-
"""
|
| 192 |
-
|
| 193 |
-
# Inject custom CSS
|
| 194 |
-
st.markdown(load_css(), unsafe_allow_html=True)
|
| 195 |
-
|
| 196 |
-
# Main content area with 3D-inspired title
|
| 197 |
-
st.markdown("<h1 class='main-title'>🚀 Welcome to EduNexus</h1>", unsafe_allow_html=True)
|
| 198 |
-
st.markdown("<p style='text-align: center; font-size: 1.2rem; margin-bottom: 2rem;'>Your AI-powered learning companion for the 21st century</p>", unsafe_allow_html=True)
|
| 199 |
-
|
| 200 |
-
# Sidebar with navigation options
|
| 201 |
-
st.sidebar.markdown("<h2 style='text-align: center;'>🧠 EduNexus Tools</h2>", unsafe_allow_html=True)
|
| 202 |
-
selected_task = st.sidebar.radio("Select a Tool", [
|
| 203 |
-
"🧑🎓 Personalized Learning Assistant",
|
| 204 |
-
"🤖 AI Coding Mentor",
|
| 205 |
-
"📄 Smart Document Summarizer",
|
| 206 |
-
"🗓 Interactive Study Planner",
|
| 207 |
-
"❓ Real-Time Q&A Support",
|
| 208 |
-
"💬 Mental Health Check-In"
|
| 209 |
-
])
|
| 210 |
-
|
| 211 |
-
# Display the selected task based on user selection
|
| 212 |
-
st.markdown(f"<h2 class='tool-title'>{selected_task}</h2>", unsafe_allow_html=True)
|
| 213 |
-
|
| 214 |
-
if selected_task == "🧑🎓 Personalized Learning Assistant":
|
| 215 |
-
st.markdown("""
|
| 216 |
-
<div class='tool-card'>
|
| 217 |
-
<h3><span class='emoji'>🎓</span>Create Your Learning Journey</h3>
|
| 218 |
-
<p>Enter a topic you're interested in, and let our AI craft a personalized learning plan just for you!</p>
|
| 219 |
-
</div>
|
| 220 |
-
""", unsafe_allow_html=True)
|
| 221 |
-
topic = st.text_input("What would you like to learn about? 🤔")
|
| 222 |
-
col1, col2 = st.columns([1, 3])
|
| 223 |
-
with col1:
|
| 224 |
-
if st.button("🧹 Clear"):
|
| 225 |
-
st.session_state['responses']["personalized_learning_assistant"] = ""
|
| 226 |
-
st.rerun()
|
| 227 |
-
with col2:
|
| 228 |
-
if st.button("🚀 Generate Learning Plan"):
|
| 229 |
-
if topic:
|
| 230 |
-
with st.spinner("Crafting your personalized learning journey..."):
|
| 231 |
-
st.session_state['responses']["personalized_learning_assistant"] = personalized_learning_assistant(topic)
|
| 232 |
-
else:
|
| 233 |
-
st.session_state['responses']["personalized_learning_assistant"] = "Please enter a topic to get started on your learning adventure! 📚"
|
| 234 |
-
|
| 235 |
-
st.markdown("<div class='response-area'>", unsafe_allow_html=True)
|
| 236 |
-
st.markdown("### Your Personalized Learning Plan:")
|
| 237 |
-
st.markdown(st.session_state['responses']["personalized_learning_assistant"])
|
| 238 |
-
st.markdown("</div>", unsafe_allow_html=True)
|
| 239 |
-
|
| 240 |
-
elif selected_task == "🤖 AI Coding Mentor":
|
| 241 |
-
st.markdown("""
|
| 242 |
-
<div class='tool-card'>
|
| 243 |
-
<h3><span class='emoji'>💻</span>Get Expert Code Review</h3>
|
| 244 |
-
<p>Paste your code snippet below, and our AI mentor will provide insightful suggestions and improvements!</p>
|
| 245 |
-
</div>
|
| 246 |
-
""", unsafe_allow_html=True)
|
| 247 |
-
code_snippet = st.text_area("Paste your code here for review 👨💻")
|
| 248 |
-
col1, col2 = st.columns([1, 3])
|
| 249 |
-
with col1:
|
| 250 |
-
if st.button("🧹 Clear"):
|
| 251 |
-
st.session_state['responses']["ai_coding_mentor"] = ""
|
| 252 |
-
st.rerun()
|
| 253 |
-
with col2:
|
| 254 |
-
if st.button("🔍 Analyze Code"):
|
| 255 |
-
if code_snippet:
|
| 256 |
-
with st.spinner("Analyzing your code with AI precision..."):
|
| 257 |
-
st.session_state['responses']["ai_coding_mentor"] = ai_coding_mentor(code_snippet)
|
| 258 |
-
else:
|
| 259 |
-
st.session_state['responses']["ai_coding_mentor"] = "Please enter a code snippet for our AI to review and enhance! 🖥️"
|
| 260 |
-
|
| 261 |
-
st.markdown("<div class='response-area'>", unsafe_allow_html=True)
|
| 262 |
-
st.markdown("### AI Code Review Results:")
|
| 263 |
-
st.code(st.session_state['responses']["ai_coding_mentor"])
|
| 264 |
-
st.markdown("</div>", unsafe_allow_html=True)
|
| 265 |
-
|
| 266 |
-
elif selected_task == "📄 Smart Document Summarizer":
|
| 267 |
-
st.markdown("""
|
| 268 |
-
<div class='tool-card'>
|
| 269 |
-
<h3><span class='emoji'>📚</span>Summarize Any Document</h3>
|
| 270 |
-
<p>Paste your document text, and watch as our AI distills it into a concise, informative summary!</p>
|
| 271 |
-
</div>
|
| 272 |
-
""", unsafe_allow_html=True)
|
| 273 |
-
document_text = st.text_area("Paste your document text here 📝")
|
| 274 |
-
col1, col2 = st.columns([1, 3])
|
| 275 |
-
with col1:
|
| 276 |
-
if st.button("🧹 Clear"):
|
| 277 |
-
st.session_state['responses']["smart_document_summarizer"] = ""
|
| 278 |
-
st.rerun()
|
| 279 |
-
with col2:
|
| 280 |
-
if st.button("📊 Summarize"):
|
| 281 |
-
if document_text:
|
| 282 |
-
with st.spinner("Condensing your document into a brilliant summary..."):
|
| 283 |
-
st.session_state['responses']["smart_document_summarizer"] = smart_document_summarizer(document_text)
|
| 284 |
-
else:
|
| 285 |
-
st.session_state['responses']["smart_document_summarizer"] = "Please paste a document for our AI to summarize! 📄"
|
| 286 |
-
|
| 287 |
-
st.markdown("<div class='response-area'>", unsafe_allow_html=True)
|
| 288 |
-
st.markdown("### Your Document Summary:")
|
| 289 |
-
st.markdown(st.session_state['responses']["smart_document_summarizer"])
|
| 290 |
-
st.markdown("</div>", unsafe_allow_html=True)
|
| 291 |
-
|
| 292 |
-
elif selected_task == "🗓 Interactive Study Planner":
|
| 293 |
-
st.markdown("""
|
| 294 |
-
<div class='tool-card'>
|
| 295 |
-
<h3><span class='emoji'>📅</span>Plan Your Study Schedule</h3>
|
| 296 |
-
<p>Input your exam dates and subjects, and let our AI create a tailored study plan to maximize your success!</p>
|
| 297 |
-
</div>
|
| 298 |
-
""", unsafe_allow_html=True)
|
| 299 |
-
exam_schedule = st.text_area("Enter your exam schedule (e.g., 'Math: May 15, Physics: May 20') 📆")
|
| 300 |
-
col1, col2 = st.columns([1, 3])
|
| 301 |
-
with col1:
|
| 302 |
-
if st.button("🧹 Clear"):
|
| 303 |
-
st.session_state['responses']["interactive_study_planner"] = ""
|
| 304 |
-
st.rerun()
|
| 305 |
-
with col2:
|
| 306 |
-
if st.button("🎯 Create Study Plan"):
|
| 307 |
-
if exam_schedule:
|
| 308 |
-
with st.spinner("Crafting your personalized study strategy..."):
|
| 309 |
-
st.session_state['responses']["interactive_study_planner"] = interactive_study_planner(exam_schedule)
|
| 310 |
-
else:
|
| 311 |
-
st.session_state['responses']["interactive_study_planner"] = "Please enter your exam schedule to get a customized study plan! 📚"
|
| 312 |
-
|
| 313 |
-
st.markdown("<div class='response-area'>", unsafe_allow_html=True)
|
| 314 |
-
st.markdown("### Your Personalized Study Plan:")
|
| 315 |
-
st.markdown(st.session_state['responses']["interactive_study_planner"])
|
| 316 |
-
st.markdown("</div>", unsafe_allow_html=True)
|
| 317 |
-
|
| 318 |
-
elif selected_task == "❓ Real-Time Q&A Support":
|
| 319 |
-
st.markdown("""
|
| 320 |
<div class='tool-card'>
|
| 321 |
-
<h3><
|
| 322 |
-
<p>
|
| 323 |
</div>
|
| 324 |
""", unsafe_allow_html=True)
|
| 325 |
-
question = st.text_input("What's your question? 🧐")
|
| 326 |
-
col1, col2 = st.columns([1, 3])
|
| 327 |
-
with col1:
|
| 328 |
-
if st.button("🧹 Clear"):
|
| 329 |
-
st.session_state['responses']["real_time_qa_support"] = ""
|
| 330 |
-
st.rerun()
|
| 331 |
-
with col2:
|
| 332 |
-
if st.button("💡 Get Answer"):
|
| 333 |
-
if question:
|
| 334 |
-
with st.spinner("Searching the depths of knowledge for your answer..."):
|
| 335 |
-
st.session_state['responses']["real_time_qa_support"] = real_time_qa_support(question)
|
| 336 |
-
else:
|
| 337 |
-
st.session_state['responses']["real_time_qa_support"] = "Please ask a question to unlock the wisdom of our AI! 🔓"
|
| 338 |
-
|
| 339 |
-
st.markdown("<div class='response-area'>", unsafe_allow_html=True)
|
| 340 |
-
st.markdown("### Your Answer:")
|
| 341 |
-
st.markdown(st.session_state['responses']["real_time_qa_support"])
|
| 342 |
-
st.markdown("</div>", unsafe_allow_html=True)
|
| 343 |
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
feelings = st.text_input("How are you feeling today? 💭")
|
| 352 |
col1, col2 = st.columns([1, 3])
|
| 353 |
with col1:
|
| 354 |
if st.button("🧹 Clear"):
|
| 355 |
-
|
| 356 |
st.rerun()
|
| 357 |
with col2:
|
| 358 |
-
if st.button("
|
| 359 |
-
if
|
| 360 |
-
with st.spinner("
|
| 361 |
-
st.session_state['responses']["
|
| 362 |
else:
|
| 363 |
-
st.session_state['responses']["
|
| 364 |
-
|
|
|
|
| 365 |
st.markdown("<div class='response-area'>", unsafe_allow_html=True)
|
| 366 |
-
st.markdown("###
|
| 367 |
-
st.markdown(st.session_state['responses']["
|
| 368 |
st.markdown("</div>", unsafe_allow_html=True)
|
| 369 |
|
| 370 |
-
#
|
| 371 |
-
st.markdown("""
|
| 372 |
-
<div class="stApp">
|
| 373 |
-
<div class="animated-bg"></div>
|
| 374 |
-
</div>
|
| 375 |
-
""", unsafe_allow_html=True)
|
| 376 |
-
|
| 377 |
-
# Footer with contact information
|
| 378 |
st.markdown("""
|
| 379 |
<div class="footer">
|
| 380 |
-
<a href="https://github.com/muhammadibrahim313" target="_blank">
|
| 381 |
-
<a href="https://www.linkedin.com/in/muhammad-ibrahim-qasmi-9876a1297/" target="_blank">
|
| 382 |
-
<a href="https://github.com/Ahmad-Fakhar" target="_blank">
|
| 383 |
-
<a href="https://www.linkedin.com/in/ahmad-fakhar-357742258/" target="_blank">
|
| 384 |
</div>
|
| 385 |
""", unsafe_allow_html=True)
|
| 386 |
|
| 387 |
-
#
|
| 388 |
-
st.balloons()
|
| 389 |
-
|
| 390 |
-
# Display a random inspirational quote
|
| 391 |
quotes = [
|
| 392 |
"The capacity to learn is a gift; the ability to learn is a skill; the willingness to learn is a choice. - Brian Herbert",
|
| 393 |
"Education is the passport to the future, for tomorrow belongs to those who prepare for it today. - Malcolm X",
|
|
@@ -398,4 +201,4 @@ elif selected_task == "💬 Mental Health Check-In":
|
|
| 398 |
st.sidebar.markdown(f"### 💡 Quote of the Day\n\n*{random.choice(quotes)}*")
|
| 399 |
|
| 400 |
if __name__ == "__main__":
|
| 401 |
-
main()
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import os
|
| 3 |
from groq import Groq
|
|
|
|
| 4 |
import random
|
| 5 |
+
api_key="3ey76"
|
| 6 |
# Set up page configuration
|
| 7 |
st.set_page_config(page_title="EduNexus 🚀", page_icon="🚀", layout="wide")
|
| 8 |
+
|
| 9 |
+
# Initialize Groq client with API key
|
| 10 |
api_key = st.secrets["GROQ_API_KEY"]
|
| 11 |
client = Groq(api_key=api_key)
|
| 12 |
|
| 13 |
+
# Define the LLaMA model
|
| 14 |
+
MODEL_NAME = "llama3-8b-8192"
|
| 15 |
|
| 16 |
# Function to call Groq API
|
| 17 |
def call_groq_api(prompt):
|
|
|
|
| 24 |
except Exception as e:
|
| 25 |
return f"Error: {str(e)}"
|
| 26 |
|
| 27 |
+
# Define tool functions
|
| 28 |
def personalized_learning_assistant(topic):
|
| 29 |
+
prompt = f"Create a personalized learning plan for the topic: {topic}"
|
| 30 |
+
return call_groq_api(prompt)
|
| 31 |
|
| 32 |
def ai_coding_mentor(code_snippet):
|
| 33 |
+
prompt = f"Review this code and provide improvements:\n{code_snippet}"
|
| 34 |
+
return call_groq_api(prompt)
|
| 35 |
|
| 36 |
def smart_document_summarizer(document_text):
|
| 37 |
+
prompt = f"Summarize this document:\n{document_text}"
|
| 38 |
+
return call_groq_api(prompt)
|
| 39 |
|
| 40 |
def interactive_study_planner(exam_schedule):
|
| 41 |
+
prompt = f"Create a study plan based on this exam schedule:\n{exam_schedule}"
|
| 42 |
+
return call_groq_api(prompt)
|
| 43 |
|
| 44 |
def real_time_qa_support(question):
|
| 45 |
+
prompt = f"Answer this question:\n{question}"
|
| 46 |
+
return call_groq_api(prompt)
|
| 47 |
|
| 48 |
def mental_health_check_in(feelings):
|
| 49 |
+
prompt = f"Provide supportive advice for someone feeling:\n{feelings}"
|
| 50 |
+
return call_groq_api(prompt)
|
| 51 |
|
| 52 |
+
# Initialize session state
|
| 53 |
if 'responses' not in st.session_state:
|
| 54 |
st.session_state['responses'] = {
|
| 55 |
"personalized_learning_assistant": "",
|
|
|
|
| 60 |
"mental_health_check_in": ""
|
| 61 |
}
|
| 62 |
|
| 63 |
+
# Function to clear session state
|
| 64 |
+
def clear_response(key):
|
| 65 |
+
st.session_state['responses'][key] = ""
|
| 66 |
+
|
| 67 |
+
# Custom CSS
|
| 68 |
+
st.markdown("""
|
| 69 |
+
<style>
|
| 70 |
+
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');
|
| 71 |
+
|
| 72 |
+
.main-title {
|
| 73 |
+
font-size: 3.5rem;
|
| 74 |
+
font-weight: 700;
|
| 75 |
+
text-align: center;
|
| 76 |
+
margin-bottom: 2rem;
|
| 77 |
+
color: #ffffff;
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
.tool-card {
|
| 81 |
+
background-color: rgba(255, 255, 255, 0.1);
|
| 82 |
+
border-radius: 20px;
|
| 83 |
+
padding: 1.5rem;
|
| 84 |
+
margin-bottom: 1rem;
|
| 85 |
+
backdrop-filter: blur(10px);
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
.response-area {
|
| 89 |
+
background-color: rgba(255, 255, 255, 0.1);
|
| 90 |
+
border-radius: 10px;
|
| 91 |
+
padding: 1rem;
|
| 92 |
+
margin-top: 1rem;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
.footer {
|
| 96 |
+
text-align: center;
|
| 97 |
+
padding: 1rem;
|
| 98 |
+
background-color: rgba(255, 255, 255, 0.1);
|
| 99 |
+
border-radius: 10px;
|
| 100 |
+
margin-top: 2rem;
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
.footer a {
|
| 104 |
+
color: #ffffff;
|
| 105 |
+
text-decoration: none;
|
| 106 |
+
margin: 0 1rem;
|
| 107 |
+
font-weight: 500;
|
| 108 |
+
}
|
| 109 |
+
</style>
|
| 110 |
+
""", unsafe_allow_html=True)
|
| 111 |
+
|
| 112 |
+
# Main app
|
| 113 |
+
def main():
|
| 114 |
+
# Title
|
| 115 |
+
st.markdown("<h1 class='main-title'>🚀 Welcome to EduNexus</h1>", unsafe_allow_html=True)
|
| 116 |
+
st.markdown("<p style='text-align: center; font-size: 1.2rem;'>Your AI-powered learning companion</p>", unsafe_allow_html=True)
|
| 117 |
+
|
| 118 |
+
# Sidebar navigation
|
| 119 |
+
st.sidebar.markdown("<h2 style='text-align: center;'>🧠 EduNexus Tools</h2>", unsafe_allow_html=True)
|
| 120 |
+
selected_task = st.sidebar.radio("Select a Tool", [
|
| 121 |
+
"🧑🎓 Personalized Learning Assistant",
|
| 122 |
+
"🤖 AI Coding Mentor",
|
| 123 |
+
"📄 Smart Document Summarizer",
|
| 124 |
+
"🗓 Interactive Study Planner",
|
| 125 |
+
"❓ Real-Time Q&A Support",
|
| 126 |
+
"💬 Mental Health Check-In"
|
| 127 |
+
])
|
| 128 |
+
|
| 129 |
+
# Tool implementations
|
| 130 |
+
tools = {
|
| 131 |
+
"🧑🎓 Personalized Learning Assistant": {
|
| 132 |
+
"key": "personalized_learning_assistant",
|
| 133 |
+
"function": personalized_learning_assistant,
|
| 134 |
+
"input_label": "What would you like to learn about? 🤔",
|
| 135 |
+
"input_type": "text_input",
|
| 136 |
+
"description": "Create a personalized learning plan just for you!"
|
| 137 |
+
},
|
| 138 |
+
"🤖 AI Coding Mentor": {
|
| 139 |
+
"key": "ai_coding_mentor",
|
| 140 |
+
"function": ai_coding_mentor,
|
| 141 |
+
"input_label": "Paste your code here for review 👨💻",
|
| 142 |
+
"input_type": "text_area",
|
| 143 |
+
"description": "Get expert code review and suggestions!"
|
| 144 |
+
},
|
| 145 |
+
# Add similar configurations for other tools
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
tool = tools.get(selected_task)
|
| 149 |
+
if tool:
|
| 150 |
+
st.markdown(f"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
<div class='tool-card'>
|
| 152 |
+
<h3>{selected_task}</h3>
|
| 153 |
+
<p>{tool['description']}</p>
|
| 154 |
</div>
|
| 155 |
""", unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
|
| 157 |
+
# Input field
|
| 158 |
+
if tool["input_type"] == "text_input":
|
| 159 |
+
user_input = st.text_input(tool["input_label"])
|
| 160 |
+
else:
|
| 161 |
+
user_input = st.text_area(tool["input_label"])
|
| 162 |
+
|
| 163 |
+
# Action buttons
|
|
|
|
| 164 |
col1, col2 = st.columns([1, 3])
|
| 165 |
with col1:
|
| 166 |
if st.button("🧹 Clear"):
|
| 167 |
+
clear_response(tool["key"])
|
| 168 |
st.rerun()
|
| 169 |
with col2:
|
| 170 |
+
if st.button("🚀 Generate"):
|
| 171 |
+
if user_input:
|
| 172 |
+
with st.spinner("Processing..."):
|
| 173 |
+
st.session_state['responses'][tool["key"]] = tool["function"](user_input)
|
| 174 |
else:
|
| 175 |
+
st.session_state['responses'][tool["key"]] = "Please provide input to continue."
|
| 176 |
+
|
| 177 |
+
# Display response
|
| 178 |
st.markdown("<div class='response-area'>", unsafe_allow_html=True)
|
| 179 |
+
st.markdown("### Response:")
|
| 180 |
+
st.markdown(st.session_state['responses'][tool["key"]])
|
| 181 |
st.markdown("</div>", unsafe_allow_html=True)
|
| 182 |
|
| 183 |
+
# Footer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 184 |
st.markdown("""
|
| 185 |
<div class="footer">
|
| 186 |
+
<a href="https://github.com/muhammadibrahim313" target="_blank">GitHub</a>
|
| 187 |
+
<a href="https://www.linkedin.com/in/muhammad-ibrahim-qasmi-9876a1297/" target="_blank">LinkedIn</a>
|
| 188 |
+
<a href="https://github.com/Ahmad-Fakhar" target="_blank">Partner's GitHub</a>
|
| 189 |
+
<a href="https://www.linkedin.com/in/ahmad-fakhar-357742258/" target="_blank">Partner's LinkedIn</a>
|
| 190 |
</div>
|
| 191 |
""", unsafe_allow_html=True)
|
| 192 |
|
| 193 |
+
# Inspirational quote
|
|
|
|
|
|
|
|
|
|
| 194 |
quotes = [
|
| 195 |
"The capacity to learn is a gift; the ability to learn is a skill; the willingness to learn is a choice. - Brian Herbert",
|
| 196 |
"Education is the passport to the future, for tomorrow belongs to those who prepare for it today. - Malcolm X",
|
|
|
|
| 201 |
st.sidebar.markdown(f"### 💡 Quote of the Day\n\n*{random.choice(quotes)}*")
|
| 202 |
|
| 203 |
if __name__ == "__main__":
|
| 204 |
+
main()
|