gladguy commited on
Commit
6ba47c6
Β·
1 Parent(s): 6be7aaf

Make educational content more prominent with emoji sections and clear headers

Browse files
Files changed (1) hide show
  1. app.py +60 -24
app.py CHANGED
@@ -131,18 +131,33 @@ def generate_anatomy_info(query: str) -> str:
131
 
132
  prompt = f"""You are an anatomy tutor for MBBS students. Provide key educational points about: {query}
133
 
134
- Format your response as a bulleted list with 5-7 important points. Include:
135
- - Definition and location
136
- - Key structural features
137
- - Clinical significance
138
- - Related anatomical structures
139
 
140
- Keep it concise and educational."""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
 
142
  payload = {
143
  "model": HYPERBOLIC_MODEL,
144
  "messages": [{"role": "user", "content": prompt}],
145
- "max_tokens": 500,
146
  "temperature": 0.7
147
  }
148
 
@@ -152,10 +167,18 @@ Keep it concise and educational."""
152
  result = response.json()
153
  info = result["choices"][0]["message"]["content"]
154
 
155
- return info
 
 
 
 
 
 
 
 
156
 
157
  except Exception as e:
158
- return f"Error generating information: {str(e)}"
159
 
160
 
161
  def generate_viva_questions(topic: str) -> list:
@@ -234,7 +257,7 @@ def evaluate_viva_answer(question: str, student_answer: str, expected_answer: st
234
  Returns (feedback, score_emoji)
235
  """
236
  if not student_answer.strip():
237
- return "Please provide an answer to continue.", "⏸️"
238
 
239
  try:
240
  headers = {
@@ -242,24 +265,32 @@ def evaluate_viva_answer(question: str, student_answer: str, expected_answer: st
242
  "Authorization": f"Bearer {HYPERBOLIC_API_KEY}"
243
  }
244
 
245
- prompt = f"""You are an anatomy professor evaluating a student's VIVA answer.
246
 
247
  Question: {question}
248
  Expected key points: {expected_answer}
249
  Student's answer: {student_answer}
250
 
251
- Evaluate the answer and provide:
252
- 1. Brief feedback (2-3 sentences)
253
- 2. What was correct
254
- 3. What was missing (if anything)
255
- 4. Score as: EXCELLENT, GOOD, FAIR, or NEEDS_IMPROVEMENT
256
 
257
- Be encouraging but honest. Format your response as friendly feedback."""
 
 
 
 
 
 
 
 
 
 
 
 
258
 
259
  payload = {
260
  "model": HYPERBOLIC_MODEL,
261
  "messages": [{"role": "user", "content": prompt}],
262
- "max_tokens": 300,
263
  "temperature": 0.6
264
  }
265
 
@@ -269,21 +300,28 @@ Be encouraging but honest. Format your response as friendly feedback."""
269
  result = response.json()
270
  feedback = result["choices"][0]["message"]["content"]
271
 
272
- # Determine emoji based on feedback content
273
  feedback_upper = feedback.upper()
274
  if "EXCELLENT" in feedback_upper:
275
  emoji = "🌟"
 
276
  elif "GOOD" in feedback_upper:
277
  emoji = "βœ…"
 
278
  elif "FAIR" in feedback_upper:
279
  emoji = "πŸ‘"
 
280
  else:
281
  emoji = "πŸ“š"
 
 
 
 
282
 
283
- return feedback, emoji
284
 
285
  except Exception as e:
286
- return f"Could not evaluate answer: {str(e)}", "⚠️"
287
 
288
 
289
  def process_anatomy_query(query: str) -> tuple:
@@ -370,9 +408,7 @@ def submit_viva_answer(answer, questions, current_q_idx):
370
  return ("VIVA Complete!", "", "", gr.update(interactive=False), current_q_idx)
371
 
372
  q = questions[current_q_idx]
373
- feedback, emoji = evaluate_viva_answer(q['question'], answer, q.get('answer', ''))
374
-
375
- feedback_text = f"{emoji} **Feedback:**\n\n{feedback}\n\n**Expected key points:** {q.get('answer', 'N/A')}"
376
 
377
  # Move to next question
378
  next_idx = current_q_idx + 1
 
131
 
132
  prompt = f"""You are an anatomy tutor for MBBS students. Provide key educational points about: {query}
133
 
134
+ Format your response with clear sections using these exact emoji icons:
 
 
 
 
135
 
136
+ πŸ“ **Location & Definition:**
137
+ [Brief description of what it is and where it's located]
138
+
139
+ πŸ” **Key Anatomical Features:**
140
+ - [Feature 1]
141
+ - [Feature 2]
142
+ - [Feature 3]
143
+
144
+ πŸ₯ **Clinical Significance:**
145
+ - [Clinical point 1]
146
+ - [Clinical point 2]
147
+
148
+ πŸ”— **Related Structures:**
149
+ - [Related structure 1]
150
+ - [Related structure 2]
151
+
152
+ πŸ’‘ **Quick Memory Tip:**
153
+ [A mnemonic or helpful tip to remember this anatomy]
154
+
155
+ Keep it concise, clear, and educational. Use simple medical terminology."""
156
 
157
  payload = {
158
  "model": HYPERBOLIC_MODEL,
159
  "messages": [{"role": "user", "content": prompt}],
160
+ "max_tokens": 600,
161
  "temperature": 0.7
162
  }
163
 
 
167
  result = response.json()
168
  info = result["choices"][0]["message"]["content"]
169
 
170
+ # Add prominent header to make it stand out
171
+ formatted_info = f"""## πŸ“š Key Learning Points
172
+
173
+ {info}
174
+
175
+ ---
176
+ πŸ’ͺ **Study Tip:** Read through these points carefully, then test yourself with VIVA mode!"""
177
+
178
+ return formatted_info
179
 
180
  except Exception as e:
181
+ return f"⚠️ Error generating information: {str(e)}"
182
 
183
 
184
  def generate_viva_questions(topic: str) -> list:
 
257
  Returns (feedback, score_emoji)
258
  """
259
  if not student_answer.strip():
260
+ return "⏸️ Please provide an answer to continue.", "⏸️"
261
 
262
  try:
263
  headers = {
 
265
  "Authorization": f"Bearer {HYPERBOLIC_API_KEY}"
266
  }
267
 
268
+ prompt = f"""You are an encouraging anatomy professor evaluating a student's VIVA answer.
269
 
270
  Question: {question}
271
  Expected key points: {expected_answer}
272
  Student's answer: {student_answer}
273
 
274
+ Provide feedback in this EXACT format:
 
 
 
 
275
 
276
+ [First, write one encouraging sentence praising effort or any correct elements]
277
+
278
+ βœ… **What was correct:**
279
+ [List what the student got right - be specific. If nothing, write "Unfortunately, the answer didn't cover the key anatomical points."]
280
+
281
+ ❌ **What was missing:**
282
+ [List what important points were missed - be specific. If nothing was missed, write "Nothing! You covered all the key points."]
283
+
284
+ **Score:** [Choose: EXCELLENT, GOOD, FAIR, or NEEDS_IMPROVEMENT]
285
+
286
+ [End with an encouraging message that motivates continued learning]
287
+
288
+ Be warm, supportive, and constructive. Celebrate correct answers enthusiastically!"""
289
 
290
  payload = {
291
  "model": HYPERBOLIC_MODEL,
292
  "messages": [{"role": "user", "content": prompt}],
293
+ "max_tokens": 400,
294
  "temperature": 0.6
295
  }
296
 
 
300
  result = response.json()
301
  feedback = result["choices"][0]["message"]["content"]
302
 
303
+ # Determine emoji and encouragement based on feedback content
304
  feedback_upper = feedback.upper()
305
  if "EXCELLENT" in feedback_upper:
306
  emoji = "🌟"
307
+ encouragement = "\n\nπŸŽ‰ **Outstanding!** You're mastering this topic! Keep up the excellent work!"
308
  elif "GOOD" in feedback_upper:
309
  emoji = "βœ…"
310
+ encouragement = "\n\nπŸ‘ **Well done!** You're doing great! A bit more practice and you'll ace this!"
311
  elif "FAIR" in feedback_upper:
312
  emoji = "πŸ‘"
313
+ encouragement = "\n\nπŸ’ͺ **Good effort!** You're on the right track. Review the key points and try again!"
314
  else:
315
  emoji = "πŸ“š"
316
+ encouragement = "\n\n🌱 **Keep learning!** Don't worry, understanding anatomy takes practice. You've got this!"
317
+
318
+ # Format the complete feedback
319
+ formatted_feedback = f"{emoji} **VIVA Feedback:**\n\n{feedback}{encouragement}\n\n---\n\nπŸ“– **Reference Answer:**\n{expected_answer}"
320
 
321
+ return formatted_feedback, emoji
322
 
323
  except Exception as e:
324
+ return f"⚠️ Could not evaluate answer: {str(e)}", "⚠️"
325
 
326
 
327
  def process_anatomy_query(query: str) -> tuple:
 
408
  return ("VIVA Complete!", "", "", gr.update(interactive=False), current_q_idx)
409
 
410
  q = questions[current_q_idx]
411
+ feedback_text, emoji = evaluate_viva_answer(q['question'], answer, q.get('answer', ''))
 
 
412
 
413
  # Move to next question
414
  next_idx = current_q_idx + 1