sparshmehta commited on
Commit
81fe53e
Β·
verified Β·
1 Parent(s): d1ab8df

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +84 -72
app.py CHANGED
@@ -436,7 +436,7 @@ class ContentAnalyzer:
436
  time.sleep(self.retry_delay * (2 ** attempt))
437
 
438
  def _create_analysis_prompt(self, transcript: str) -> str:
439
- """Create the analysis prompt with balanced evaluation criteria"""
440
  # First try to extract existing timestamps
441
  timestamps = re.findall(r'\[(\d{2}:\d{2})\]', transcript)
442
 
@@ -462,9 +462,9 @@ Example: If a quote starts at word 300, timestamp would be [02:00] (300 words /
462
  marked_transcript += word + " "
463
  transcript = marked_transcript
464
 
465
- prompt_template = """Analyze this teaching content objectively. Each criterion should be evaluated independently with reasonable standards - neither too strict nor too lenient.
466
 
467
- Score 1 if the criterion meets reasonable standards, 0 if it does not.
468
 
469
  Transcript:
470
  {transcript}
@@ -472,96 +472,108 @@ Transcript:
472
  Timestamp Instructions:
473
  {timestamp_instruction}
474
 
475
- Required JSON structure:
476
- {{
477
- "Concept Assessment": {{
478
- "Subject Matter Accuracy": {{
479
- "Score": 0 or 1, # Score 1 if content is generally accurate with only minor errors
480
- "Citations": ["[MM:SS] Quote demonstrating accuracy or error"]
481
- }},
482
- "First Principles Approach": {{
483
- "Score": 0 or 1, # Score 1 if key concepts are built from fundamentals
484
- "Citations": ["[MM:SS] Quote showing concept explanation"]
485
- }},
486
- "Examples and Business Context": {{
487
- "Score": 0 or 1, # Score 1 if at least 2 relevant examples are provided
488
- "Citations": ["[MM:SS] Quote containing practical example"]
489
- }},
490
- "Cohesive Storytelling": {{
491
- "Score": 0 or 1, # Score 1 if content flows logically most of the time
492
- "Citations": ["[MM:SS] Quote showing topic transition"]
493
- }},
494
- "Engagement and Interaction": {{
495
- "Score": 0 or 1, # Score 1 if there's meaningful audience engagement
496
- "Citations": ["[MM:SS] Quote showing audience engagement"]
497
- }},
498
- "Professional Tone": {{
499
- "Score": 0 or 1, # Score 1 if tone is generally professional
500
- "Citations": ["[MM:SS] Quote demonstrating tone"]
501
- }}
502
- }},
503
- "Code Assessment": {{
504
- "Depth of Explanation": {{
505
- "Score": 0 or 1, # Score 1 if code concepts are explained clearly
506
- "Citations": ["[MM:SS] Quote showing code explanation"]
507
- }},
508
- "Output Interpretation": {{
509
- "Score": 0 or 1, # Score 1 if important outputs are explained
510
- "Citations": ["[MM:SS] Quote demonstrating output explanation"]
511
- }},
512
- "Breaking down Complexity": {{
513
- "Score": 0 or 1, # Score 1 if complex concepts are made understandable
514
- "Citations": ["[MM:SS] Quote showing concept breakdown"]
515
- }}
516
- }}
517
- }}
518
 
519
- Balanced Scoring Guidelines:
520
 
521
  Subject Matter Accuracy:
522
- βœ“ Pass: Content is technically sound with occasional minor errors
523
- βœ— Fail: Multiple significant errors or fundamental misunderstandings
 
 
 
 
 
 
524
 
525
  First Principles Approach:
526
- βœ“ Pass: Core concepts are explained from basic principles
527
- βœ— Fail: Advanced concepts introduced without basic foundation
 
 
 
 
 
 
528
 
529
  Examples and Business Context:
530
- βœ“ Pass: At least 2 relevant examples that illustrate concepts
531
- βœ— Fail: Examples missing or irrelevant to the topic
 
 
 
 
 
 
532
 
533
  Cohesive Storytelling:
534
- βœ“ Pass: Topics generally flow well with clear connections
535
- βœ— Fail: Frequent jumps between unrelated topics
 
 
 
 
 
 
536
 
537
  Engagement and Interaction:
538
- βœ“ Pass: Some effective engagement with audience
539
- βœ— Fail: One-way lecture with no audience consideration
 
 
 
 
 
 
540
 
541
  Professional Tone:
542
- βœ“ Pass: Generally professional with occasional casual moments
543
- βœ— Fail: Consistently unprofessional or inappropriate
 
 
 
 
 
 
 
 
544
 
545
  Depth of Explanation:
546
- βœ“ Pass: Key code concepts explained with reasonable detail
547
- βœ— Fail: Code presented without meaningful explanation
 
 
 
 
 
 
548
 
549
  Output Interpretation:
550
- βœ“ Pass: Important outputs and their significance explained
551
- βœ— Fail: Outputs shown without context or explanation
 
 
 
 
 
 
552
 
553
  Breaking down Complexity:
554
- βœ“ Pass: Complex topics broken into understandable parts
555
- βœ— Fail: Complex concepts left unexplained
 
 
 
 
 
 
556
 
557
  Important Notes:
558
- - Evaluate each criterion independently
559
- - Perfect delivery is not required for a passing score
560
- - Look for evidence of competent teaching rather than flawless execution
561
- - Consider the overall effectiveness for the target audience
562
- - One or two minor issues should not result in failure
563
- - Citations must support the scoring decision
564
- - Different criteria can and should receive different scores based on their individual merits"""
565
 
566
  return prompt_template.format(
567
  transcript=transcript,
 
436
  time.sleep(self.retry_delay * (2 ** attempt))
437
 
438
  def _create_analysis_prompt(self, transcript: str) -> str:
439
+ """Create the analysis prompt with stricter evaluation criteria"""
440
  # First try to extract existing timestamps
441
  timestamps = re.findall(r'\[(\d{2}:\d{2})\]', transcript)
442
 
 
462
  marked_transcript += word + " "
463
  transcript = marked_transcript
464
 
465
+ prompt_template = """Analyze this teaching content with strict standards. Each criterion must meet specific requirements for a passing score.
466
 
467
+ Score 1 ONLY if ALL requirements are met with clear evidence. Score 0 if ANY requirement is not fully met.
468
 
469
  Transcript:
470
  {transcript}
 
472
  Timestamp Instructions:
473
  {timestamp_instruction}
474
 
475
+ Required JSON structure remains the same, but with stricter scoring criteria:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
476
 
477
+ Concept Assessment Criteria:
478
 
479
  Subject Matter Accuracy:
480
+ βœ“ Score 1 if ALL:
481
+ - No significant technical errors
482
+ - Concepts explained with precise terminology
483
+ - Clear distinction between facts and opinions
484
+ βœ— Score 0 if ANY:
485
+ - Contains technical inaccuracies
486
+ - Uses imprecise or incorrect terminology
487
+ - Mixes facts with unsupported claims
488
 
489
  First Principles Approach:
490
+ βœ“ Score 1 if ALL:
491
+ - Starts with fundamental concepts
492
+ - Builds complexity systematically
493
+ - Clear connections between basic and advanced concepts
494
+ βœ— Score 0 if ANY:
495
+ - Jumps to advanced concepts without foundation
496
+ - Missing logical progression
497
+ - Unclear connections between concepts
498
 
499
  Examples and Business Context:
500
+ βœ“ Score 1 if ALL:
501
+ - At least 2 relevant, detailed examples
502
+ - Clear business context for each example
503
+ - Examples directly support learning objectives
504
+ βœ— Score 0 if ANY:
505
+ - Fewer than 2 examples
506
+ - Examples lack business context
507
+ - Examples don't clearly support learning
508
 
509
  Cohesive Storytelling:
510
+ βœ“ Score 1 if ALL:
511
+ - Clear narrative structure
512
+ - Logical topic transitions
513
+ - Consistent theme throughout
514
+ βœ— Score 0 if ANY:
515
+ - Disjointed narrative
516
+ - Abrupt topic changes
517
+ - Inconsistent theme
518
 
519
  Engagement and Interaction:
520
+ βœ“ Score 1 if ALL:
521
+ - Regular audience engagement
522
+ - Effective use of questions
523
+ - Clear response to audience cues
524
+ βœ— Score 0 if ANY:
525
+ - Minimal audience interaction
526
+ - One-way lecture style
527
+ - Misses engagement opportunities
528
 
529
  Professional Tone:
530
+ βœ“ Score 1 if ALL:
531
+ - Consistently professional language
532
+ - Appropriate level of formality
533
+ - Clear and confident delivery
534
+ βœ— Score 0 if ANY:
535
+ - Casual or inappropriate language
536
+ - Inconsistent formality
537
+ - Uncertain or unclear delivery
538
+
539
+ Code Assessment Criteria:
540
 
541
  Depth of Explanation:
542
+ βœ“ Score 1 if ALL:
543
+ - Explains code purpose and structure
544
+ - Covers implementation details
545
+ - Addresses potential issues/alternatives
546
+ βœ— Score 0 if ANY:
547
+ - Surface-level explanation
548
+ - Missing implementation details
549
+ - No discussion of alternatives
550
 
551
  Output Interpretation:
552
+ βœ“ Score 1 if ALL:
553
+ - Clear explanation of expected outputs
554
+ - Error handling discussion
555
+ - Performance implications covered
556
+ βœ— Score 0 if ANY:
557
+ - Unclear output expectations
558
+ - No error handling discussion
559
+ - Missing performance context
560
 
561
  Breaking down Complexity:
562
+ βœ“ Score 1 if ALL:
563
+ - Complex concepts broken into digestible parts
564
+ - Clear step-by-step explanation
565
+ - Logical progression of difficulty
566
+ βœ— Score 0 if ANY:
567
+ - Overwhelming complexity
568
+ - Missing steps in explanation
569
+ - Illogical difficulty progression
570
 
571
  Important Notes:
572
+ - Each criterion is evaluated independently
573
+ - Citations must directly support scoring decision
574
+ - No partial credit - must meet ALL requirements for a score of 1
575
+ - Look for explicit evidence in transcript
576
+ - Different criteria can receive different scores based on evidence"""
 
 
577
 
578
  return prompt_template.format(
579
  transcript=transcript,