File size: 15,358 Bytes
343bf49 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 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 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SmartLearn - AI-Powered Education Platform</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link rel="stylesheet" href="{{ url_for('static', filename='student_homework.css') }}">
</head>
<body>
<style>
.logo {
font-size: 28px;
font-weight: 700;
color: #fff;
text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
display: flex;
align-items: center;
}
.spinner {
text-align: center;
font-size: 1.5em;
margin-top: 10px;
}
.logo img {
height: 40px;
margin-right: 10px;
}
.nav-bar {
background-color: #fff;
padding: 10px 0;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.nav-bar ul {
list-style-type: none;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
}
.nav-bar li {
margin: 0 15px;
}
.nav-bar a {
text-decoration: none;
color: var(--text-color);
font-weight: 600;
transition: all 0.3s ease;
display: flex;
align-items: center;
}
.nav-bar a img {
height: 24px;
margin-right: 5px;
}
</style>
<body>
<header>
<div class="container">
<div class="header-content">
<div class="logo">
<img src="../static/smart-learn.jpeg" alt="">SmartLearn
</div>
<div class="search-bar">
<input type="text" placeholder="Search for anything">
<div class="ai-tools">
<i class="fas fa-camera" title="Photo Question Answering"></i>
<i class="fas fa-brain" title="AI Tutor"></i>
<i class="fas fa-robot" title="AI Assistant"></i>
</div>
</div>
<div class="user-actions">
<span class="points-display">1500 pts</span>
<div class="profile-icon">A</div>
</div>
</div>
</div>
</header>
<nav class="nav-bar">
<ul>
<li><a href="{{ url_for('student') }}"><img src="https://cdn-icons-png.flaticon.com/512/1946/1946488.png" alt="Home">Home</a></li>
<li><a href="{{ url_for('student') }}#ai-powered-tools"><img src="https://www.kalupurbank.com/wp-content/uploads/2023/02/robot-chatbot-icon-sign-free-vector.webp" alt="Home">Ai Tools</a></li>
<li><a href="{{ url_for('homework') }}"><img src="https://cdn-icons-png.flaticon.com/512/1828/1828919.png" alt="Homework">Homework</a></li>
<li><a href="{{ url_for('student_courses') }}"><img src="https://cdn-icons-png.flaticon.com/512/1048/1048953.png" alt="Courses">Courses</a></li>
<li><a href="{{ url_for('speak') }}"><img src="https://cdn-icons-png.flaticon.com/512/4712/4712026.png" alt="Speak With AI">Speak With AI</a></li>
<li><a href="{{ url_for('summarise_video') }}"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/0/09/YouTube_full-color_icon_%282017%29.svg/1280px-YouTube_full-color_icon_%282017%29.svg.png" alt="Ssummarise_video">summarise_video</a></li>
</ul>
</nav>
<div class="container">
<div class="main-content">
<h1>Homework & Assignments</h1>
<div class="filter-buttons">
<button class="filter-btn active">All</button>
<button class="filter-btn">Pending</button>
<button class="filter-btn">Completed</button>
</div>
<div class="homework-grid">
<div class="homework-item">
<h3>Math Assignment: Calculus Basics</h3>
<p><i class="fas fa-calendar"></i> Due: July 30, 2024</p>
<p><i class="fas fa-clock"></i> Estimated time: 30 min</p>
<a href="#" class="btn" onclick="showQuestions('calculus')">Start Assignment</a>
<div class="questions" id="calculus">
<div class="spinner" id="loading-spinner" style="display: none;">
<i class="fas fa-circle-notch fa-spin"></i> Loading...
</div>
</div>
</div>
<div class="homework-item">
<h3>Science Project: Ecosystem Model</h3>
<p><i class="fas fa-calendar"></i> Due: August 5, 2024</p>
<p><i class="fas fa-clock"></i> Estimated time: 4 hours</p>
<a href="#" class="btn" onclick="showQuestions('ecosystem')">Continue Project</a>
<div class="questions" id="ecosystem"></div>
</div>
<div class="homework-item completed">
<h3>History Essay: Industrial Revolution</h3>
<p><i class="fas fa-check-circle"></i> Completed</p>
<p><i class="fas fa-star"></i> Score: 95/100</p>
<a href="#" class="btn" onclick="showQuestions('industrial')">View Feedback</a>
<div class="questions" id="industrial"></div>
</div>
<div class="homework-item">
<h3>Language Arts: Book Report</h3>
<p><i class="fas fa-calendar"></i> Due: August 10, 2024</p>
<p><i class="fas fa-clock"></i> Estimated time: 3 hours</p>
<a href="#" class="btn" onclick="showQuestions('bookReport')">Start Report</a>
<div class="questions" id="bookReport"></div>
</div>
<div class="homework-item completed">
<h3>Computer Science: Python Quiz</h3>
<p><i class="fas fa-check-circle"></i> Completed</p>
<p><i class="fas fa-star"></i> Score: 88/100</p>
<a href="#" class="btn" onclick="showQuestions('pythonQuiz')">Review Quiz</a>
<div class="questions" id="pythonQuiz"></div>
</div>
<div class="homework-item">
<h3>Physics Lab: Gravity Experiment</h3>
<p><i class="fas fa-calendar"></i> Due: August 15, 2024</p>
<p><i class="fas fa-clock"></i> Estimated time: 2 hours</p>
<a href="#" class="btn" onclick="showQuestions('gravityExperiment')">Start Lab</a>
<div class="questions" id="gravityExperiment"></div>
</div>
<div class="homework-item">
<h3>Chemistry: Periodic Table Quiz</h3>
<p><i class="fas fa-calendar"></i> Due: August 20, 2024</p>
<p><i class="fas fa-clock"></i> Estimated time: 1 hour</p>
<a href="#" class="btn" onclick="showQuestions('periodicQuiz')">Start Quiz</a>
<div class="questions" id="periodicQuiz"></div>
</div>
<div class="homework-item">
<h3>Art Project: Self-Portrait</h3>
<p><i class="fas fa-calendar"></i> Due: August 25, 2024</p>
<p><i class="fas fa-clock"></i> Estimated time: 5 hours</p>
<a href="#" class="btn" onclick="showQuestions('selfPortrait')">Begin Project</a>
<div class="questions" id="selfPortrait"></div>
</div>
</div>
</div>
</div>
<script>
// Predefined static questions, marks, and feedback for each assignment
const questions = {
calculus: {
questions: [
"What is the derivative of sin(x)?",
"Explain the concept of a limit in calculus."
]
},
ecosystem: {
questions: [
"Describe the energy flow in an ecosystem.",
"What are the main components of an ecosystem?"
]
},
industrial: {
questions: [],
mark: 95,
feedback: "Excellent analysis and well-structured essay on the Industrial Revolution."
},
bookReport: {
questions: [
"Summarize the main plot of the book.",
"What are the key themes explored in the book?"
]
},
pythonQuiz: {
questions: [],
mark: 88,
feedback: "Good understanding of Python basics. Pay more attention to edge cases."
},
gravityExperiment: {
questions: [
"What is the formula for gravitational force?",
"Describe the experiment setup for measuring gravity."
]
},
periodicQuiz: {
questions: [
"What is the atomic number of Oxygen?",
"Explain the significance of periods and groups in the periodic table."
]
},
selfPortrait: {
questions: [
"What materials will you use for your self-portrait?",
"Describe your initial concept for the self-portrait."
]
}
};
// Function to display questions and feedback
function showQuestions(id) {
const container = document.getElementById(id);
container.innerHTML = ''; // Clear any previous content
const assignment = questions[id];
if (assignment.questions && assignment.questions.length > 0) {
assignment.questions.forEach(question => {
const questionDiv = document.createElement('div');
questionDiv.classList.add('question');
questionDiv.textContent = question;
container.appendChild(questionDiv);
});
}
if (assignment.mark !== undefined && assignment.feedback !== undefined) {
const feedbackDiv = document.createElement('div');
feedbackDiv.classList.add('feedback');
feedbackDiv.innerHTML = `<strong>Mark:</strong> ${assignment.mark}/100<br><strong>Feedback:</strong> ${assignment.feedback}`;
container.appendChild(feedbackDiv);
}
}
// Simple filter functionality
const filterButtons = document.querySelectorAll('.filter-btn');
const homeworkItems = document.querySelectorAll('.homework-item');
filterButtons.forEach(button => {
button.addEventListener('click', () => {
const filter = button.textContent.toLowerCase();
filterButtons.forEach(btn => btn.classList.remove('active'));
button.classList.add('active');
homeworkItems.forEach(item => {
if (filter === 'all' ||
(filter === 'pending' && !item.classList.contains('completed')) ||
(filter === 'completed' && item.classList.contains('completed'))) {
item.style.display = 'block';
} else {
item.style.display = 'none';
}
});
});
});
</script>
<script>
function showQuestions(assignmentId) {
const questionsDiv = document.getElementById(assignmentId);
const loadingSpinner = document.getElementById('loading-spinner');
loadingSpinner.style.display = 'block';
fetch('/generate-questions-hw')
.then(response => response.json())
.then(data => {
questionsDiv.innerHTML = '';
loadingSpinner.style.display = 'none';
data.questions.forEach((question, index) => {
const questionElement = document.createElement('div');
questionElement.innerHTML = `
<p>${index + 1}. ${question}</p>
<textarea id="answer-${index}" rows="3" cols="50"></textarea>
`;
questionsDiv.appendChild(questionElement);
});
const submitButton = document.createElement('button');
submitButton.textContent = 'Submit Answers';
submitButton.onclick = () => submitAnswers(assignmentId, data.questions);
questionsDiv.appendChild(submitButton);
})
.catch(error => {
console.error('Error:', error);
loadingSpinner.style.display = 'none';
questionsDiv.innerHTML = '<p>Error loading questions. Please try again.</p>';
});
}
function submitAnswers(assignmentId, questions) {
const questionsDiv = document.getElementById(assignmentId);
const answers = questions.map((_, index) => document.getElementById(`answer-${index}`).value);
questionsDiv.innerHTML = '<p>Evaluating answers...</p>';
fetch('/evaluate-answers', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({questions, answers}),
})
.then(response => response.json())
.then(data => {
displayEvaluations(assignmentId, questions, answers, data.evaluations);
})
.catch(error => {
console.error('Error:', error);
questionsDiv.innerHTML = '<p>Error evaluating answers. Please try again.</p>';
});
}
function displayEvaluations(assignmentId, questions, answers, evaluations) {
const questionsDiv = document.getElementById(assignmentId);
questionsDiv.innerHTML = '<h3>Evaluation Results:</h3>';
questions.forEach((question, index) => {
const answer = answers[index];
const evaluation = evaluations[index];
const resultElement = document.createElement('div');
resultElement.innerHTML = `
<p><strong>Question ${index + 1}:</strong> ${question}</p>
<p><strong>Your Answer:</strong> ${answer}</p>
<p><strong>Evaluation:</strong></p>
<pre>${evaluation}</pre>
`;
questionsDiv.appendChild(resultElement);
});
}
</script>
</body>
</html> |