sparshmehta commited on
Commit
bf4c923
·
verified ·
1 Parent(s): 7f76cfd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -39
app.py CHANGED
@@ -315,63 +315,46 @@ class ContentAnalyzer:
315
  if progress_callback:
316
  progress_callback(0.2, "Preparing content analysis...")
317
 
318
- # Remove any truncation of transcript - pass full text to API
 
 
 
 
 
 
 
 
 
 
 
 
 
319
  prompt = self._create_analysis_prompt(transcript)
320
- logger.info(f"Sending full transcript of length: {len(transcript)} characters")
321
 
322
  if progress_callback:
323
  progress_callback(0.5, "Processing with AI model...")
324
 
325
  try:
326
  response = self.client.chat.completions.create(
327
- model="gpt-4o-mini",
328
  messages=[
329
  {"role": "system", "content": """You are a strict teaching evaluator focusing on core teaching competencies.
330
- Maintain high standards and require clear evidence of quality teaching.
 
 
331
 
332
  Score of 1 requires meeting ALL criteria below with clear evidence.
333
  Score of 0 if ANY major teaching deficiency is present.
334
 
335
- Concept Assessment Scoring Criteria:
336
- - Subject Matter Accuracy (Score 1 requires: Completely accurate information, no errors)
337
- - First Principles Approach (Score 1 requires: Clear explanation of fundamentals before complex topics)
338
- - Examples and Business Context (Score 1 requires: At least 2 relevant examples with business context)
339
- - Cohesive Storytelling (Score 1 requires: Clear logical flow with smooth transitions)
340
- - Engagement and Interaction (Score 1 requires: At least 3 engagement points or questions)
341
- - Professional Tone (Score 1 requires: Consistently professional delivery)
342
-
343
- Code Assessment Scoring Criteria:
344
- - Depth of Explanation (Score 1 requires: Thorough explanation of implementation details)
345
- - Output Interpretation (Score 1 requires: Clear connection between code outputs and business value)
346
- - Breaking down Complexity (Score 1 requires: Systematic breakdown of complex concepts)
347
-
348
- Major Teaching Deficiencies (ANY of these results in Score 0):
349
- - Any factual errors
350
- - Missing foundational explanations
351
- - Insufficient examples or business context
352
- - Disorganized presentation
353
- - Limited learner engagement
354
- - Unprofessional language
355
- - Superficial code explanation
356
- - Missing business context
357
- - Poor complexity management
358
 
359
- Citations Requirements:
360
- - Include specific timestamps [MM:SS]
361
- - Provide examples for both good and poor teaching moments
362
- - Note specific instances of criteria being met or missed
363
-
364
- For each improvement suggestion, categorize it as one of:
365
- - COMMUNICATION: Related to speaking, pace, tone, clarity, delivery
366
- - TEACHING: Related to explanation, examples, engagement, structure
367
- - TECHNICAL: Related to code, implementation, technical concepts
368
-
369
- Always respond with valid JSON containing these exact categories."""},
370
  {"role": "user", "content": prompt}
371
  ],
372
  response_format={"type": "json_object"},
373
- temperature=0.3 # Lower temperature for stricter evaluation
374
  )
 
375
  logger.info("API call successful")
376
  except Exception as api_error:
377
  logger.error(f"API call failed: {str(api_error)}")
 
315
  if progress_callback:
316
  progress_callback(0.2, "Preparing content analysis...")
317
 
318
+ # Extract existing timestamps or generate them
319
+ timestamps = re.findall(r'\[(\d{2}:\d{2})\]', transcript)
320
+ if not timestamps:
321
+ # Generate timestamps based on word position
322
+ words = transcript.split()
323
+ words_per_minute = 150 # average speaking rate
324
+ marked_transcript = ""
325
+ for i, word in enumerate(words):
326
+ if i % 150 == 0: # Add marker every ~1 minute of speech
327
+ minutes = i // 150
328
+ marked_transcript += f"\n[{minutes:02d}:00] "
329
+ marked_transcript += word + " "
330
+ transcript = marked_transcript
331
+
332
  prompt = self._create_analysis_prompt(transcript)
 
333
 
334
  if progress_callback:
335
  progress_callback(0.5, "Processing with AI model...")
336
 
337
  try:
338
  response = self.client.chat.completions.create(
339
+ model="gpt-4o-mini", # Changed from gpt-4o-mini to gpt-4 for better analysis
340
  messages=[
341
  {"role": "system", "content": """You are a strict teaching evaluator focusing on core teaching competencies.
342
+ For each assessment point, you MUST include specific timestamps [MM:SS] from the transcript.
343
+ Never use [00:00] as a placeholder - only use actual timestamps from the transcript.
344
+ Each citation must include both the timestamp and a relevant quote showing evidence.
345
 
346
  Score of 1 requires meeting ALL criteria below with clear evidence.
347
  Score of 0 if ANY major teaching deficiency is present.
348
 
349
+ Citations format: "[MM:SS] Exact quote from transcript showing evidence"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
350
 
351
+ Maintain high standards and require clear evidence of quality teaching."""},
 
 
 
 
 
 
 
 
 
 
352
  {"role": "user", "content": prompt}
353
  ],
354
  response_format={"type": "json_object"},
355
+ temperature=0.3
356
  )
357
+
358
  logger.info("API call successful")
359
  except Exception as api_error:
360
  logger.error(f"API call failed: {str(api_error)}")