sparshmehta commited on
Commit
d1ab8df
Β·
verified Β·
1 Parent(s): 202976e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +61 -77
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 more balanced evaluation criteria"""
440
  # First try to extract existing timestamps
441
  timestamps = re.findall(r'\[(\d{2}:\d{2})\]', transcript)
442
 
@@ -462,7 +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 with balanced evaluation criteria. Score 1 if most key requirements are met.
 
 
466
 
467
  Transcript:
468
  {transcript}
@@ -474,110 +476,92 @@ Required JSON structure:
474
  {{
475
  "Concept Assessment": {{
476
  "Subject Matter Accuracy": {{
477
- "Score": 1, # Score 1 if technical information is generally accurate with minor errors acceptable
478
  "Citations": ["[MM:SS] Quote demonstrating accuracy or error"]
479
  }},
480
  "First Principles Approach": {{
481
- "Score": 1, # Score 1 if most concepts are built from fundamentals with clear progression
482
- "Citations": ["[MM:SS] Quote showing fundamental concept explanation"]
483
  }},
484
  "Examples and Business Context": {{
485
- "Score": 1, # Score 1 if at least 2 relevant real-world examples are provided
486
  "Citations": ["[MM:SS] Quote containing practical example"]
487
  }},
488
  "Cohesive Storytelling": {{
489
- "Score": 1, # Score 1 if most transitions are smooth with clear connections between topics
490
- "Citations": ["[MM:SS] Quote showing topic transition or connection"]
491
  }},
492
  "Engagement and Interaction": {{
493
- "Score": 1, # Score 1 if at least 1 engagement technique is used effectively
494
  "Citations": ["[MM:SS] Quote showing audience engagement"]
495
  }},
496
  "Professional Tone": {{
497
- "Score": 1, # Score 1 if language is generally professional with occasional casual expressions acceptable
498
  "Citations": ["[MM:SS] Quote demonstrating tone"]
499
  }}
500
  }},
501
  "Code Assessment": {{
502
  "Depth of Explanation": {{
503
- "Score": 1, # Score 1 if most code concepts include what and why explanations
504
  "Citations": ["[MM:SS] Quote showing code explanation"]
505
  }},
506
  "Output Interpretation": {{
507
- "Score": 1, # Score 1 if most code outputs are explained with their significance
508
  "Citations": ["[MM:SS] Quote demonstrating output explanation"]
509
  }},
510
  "Breaking down Complexity": {{
511
- "Score": 1, # Score 1 if complex concepts are generally broken into understandable components
512
  "Citations": ["[MM:SS] Quote showing concept breakdown"]
513
  }}
514
  }}
515
  }}
516
 
517
- Balanced Evaluation Criteria:
518
-
519
- Concept Assessment:
520
- 1. Subject Matter Accuracy:
521
- - Generally accurate technical information
522
- - Minor errors acceptable if core concepts are correct
523
- - Clear explanation of key technical terms
524
- - Comprehensive coverage of main concepts
525
-
526
- 2. First Principles Approach:
527
- - Most concepts built from fundamental principles
528
- - Clear progression in concept difficulty
529
- - Basic concepts explained before advanced ones
530
- - Logical sequence of topics
531
-
532
- 3. Examples and Business Context:
533
- - At least 2 relevant real-world examples
534
- - Examples clearly related to concepts
535
- - Business value explained
536
- - Practical applications discussed
537
-
538
- 4. Cohesive Storytelling:
539
- - Most topics connected logically
540
- - Generally clear narrative flow
541
- - Smooth transitions between main topics
542
- - Consistent overall structure
543
-
544
- 5. Engagement and Interaction:
545
- - At least 1 engagement technique used
546
- - Some audience involvement
547
- - Occasional checks for understanding
548
- - Varied teaching approach
549
-
550
- 6. Professional Tone:
551
- - Generally professional language
552
- - Occasional casual expressions acceptable
553
- - Clear delivery
554
- - Appropriate level of formality
555
-
556
- Code Assessment:
557
- 1. Depth of Explanation:
558
- - Most code concepts explain what and why
559
- - Key implementation details covered
560
- - Important design decisions explained
561
- - Best practices mentioned
562
-
563
- 2. Output Interpretation:
564
- - Most code outputs explained
565
- - Key error cases covered
566
- - Expected results discussed
567
- - Basic validation covered
568
-
569
- 3. Breaking down Complexity:
570
- - Complex concepts divided into components
571
- - Step-by-step explanation of key concepts
572
- - Logical organization
573
- - Dependencies explained
574
-
575
- Important:
576
- - Score 1 if most criteria in a category are met
577
- - Minor gaps or imperfections acceptable
578
- - Each citation must include timestamp and relevant quote
579
- - Citations should demonstrate how criteria are met
580
- - Be balanced in scoring - perfection not required"""
581
 
582
  return prompt_template.format(
583
  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 balanced 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 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}
 
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,