sparshmehta commited on
Commit
732496c
Β·
verified Β·
1 Parent(s): a6d2681

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +95 -66
app.py CHANGED
@@ -458,22 +458,12 @@ Do not create new timestamps."""
458
  timestamp_instruction = """Generate timestamps based on word position:
459
  1. Count words from start of transcript
460
  2. Calculate time: (word_count / 150) minutes
461
- 3. Format as [MM:SS]
462
- Example: If a quote starts at word 300, timestamp would be [02:00] (300 words / 150 words per minute)"""
463
-
464
- # Add word position markers
465
- words = transcript.split()
466
- marked_transcript = ""
467
- for i, word in enumerate(words):
468
- if i % 150 == 0:
469
- minutes = i // 150
470
- marked_transcript += f"\n[{minutes:02d}:00] "
471
- marked_transcript += word + " "
472
- transcript = marked_transcript
473
 
474
- prompt_template = """Analyze this teaching content with strict standards. Each criterion must meet specific requirements for a passing score.
475
 
476
  Score 1 ONLY if ALL requirements are met with clear evidence. Score 0 if ANY requirement is not fully met.
 
477
 
478
  Transcript:
479
  {transcript}
@@ -481,39 +471,81 @@ Transcript:
481
  Timestamp Instructions:
482
  {timestamp_instruction}
483
 
484
- Required JSON structure remains the same, but with stricter scoring criteria:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
485
 
486
- Concept Assessment Criteria:
487
 
488
  Subject Matter Accuracy:
489
  βœ“ Score 1 if ALL:
490
- - No significant technical errors
491
- - Concepts explained with precise terminology
492
- - Clear distinction between facts and opinions
493
  βœ— Score 0 if ANY:
494
- - Contains technical inaccuracies
495
- - Uses imprecise or incorrect terminology
496
- - Mixes facts with unsupported claims
497
 
498
  First Principles Approach:
499
  βœ“ Score 1 if ALL:
500
  - Starts with fundamental concepts
501
  - Builds complexity systematically
502
- - Clear connections between basic and advanced concepts
503
  βœ— Score 0 if ANY:
504
- - Jumps to advanced concepts without foundation
 
505
  - Missing logical progression
506
- - Unclear connections between concepts
507
 
508
  Examples and Business Context:
509
  βœ“ Score 1 if ALL:
510
- - At least 2 relevant, detailed examples
511
- - Clear business context for each example
512
- - Examples directly support learning objectives
513
  βœ— Score 0 if ANY:
514
- - Fewer than 2 examples
515
- - Examples lack business context
516
- - Examples don't clearly support learning
517
 
518
  Cohesive Storytelling:
519
  βœ“ Score 1 if ALL:
@@ -521,68 +553,65 @@ Cohesive Storytelling:
521
  - Logical topic transitions
522
  - Consistent theme throughout
523
  βœ— Score 0 if ANY:
524
- - Disjointed narrative
525
  - Abrupt topic changes
526
- - Inconsistent theme
527
 
528
  Engagement and Interaction:
529
  βœ“ Score 1 if ALL:
530
- - Regular audience engagement
531
- - Effective use of questions
532
- - Clear response to audience cues
533
  βœ— Score 0 if ANY:
534
- - Minimal audience interaction
535
  - One-way lecture style
536
- - Misses engagement opportunities
 
537
 
538
  Professional Tone:
539
  βœ“ Score 1 if ALL:
540
- - Consistently professional language
541
- - Appropriate level of formality
542
- - Clear and confident delivery
543
  βœ— Score 0 if ANY:
544
- - Casual or inappropriate language
545
- - Inconsistent formality
546
- - Uncertain or unclear delivery
547
-
548
- Code Assessment Criteria:
549
 
550
  Depth of Explanation:
551
  βœ“ Score 1 if ALL:
552
- - Explains code purpose and structure
553
  - Covers implementation details
554
- - Addresses potential issues/alternatives
555
  βœ— Score 0 if ANY:
556
  - Surface-level explanation
557
- - Missing implementation details
558
- - No discussion of alternatives
559
 
560
  Output Interpretation:
561
  βœ“ Score 1 if ALL:
562
- - Clear explanation of expected outputs
563
- - Error handling discussion
564
- - Performance implications covered
565
  βœ— Score 0 if ANY:
566
  - Unclear output expectations
567
- - No error handling discussion
568
- - Missing performance context
569
 
570
  Breaking down Complexity:
571
  βœ“ Score 1 if ALL:
572
- - Complex concepts broken into digestible parts
573
- - Clear step-by-step explanation
574
- - Logical progression of difficulty
575
  βœ— Score 0 if ANY:
576
  - Overwhelming complexity
577
- - Missing steps in explanation
578
- - Illogical difficulty progression
579
-
580
- Important Notes:
581
- - Each criterion is evaluated independently
582
- - Citations must directly support scoring decision
583
- - No partial credit - must meet ALL requirements for a score of 1
584
- - Look for explicit evidence in transcript
585
- - Different criteria can receive different scores based on evidence"""
586
 
587
  return prompt_template.format(
588
  transcript=transcript,
 
458
  timestamp_instruction = """Generate timestamps based on word position:
459
  1. Count words from start of transcript
460
  2. Calculate time: (word_count / 150) minutes
461
+ 3. Format as [MM:SS]"""
 
 
 
 
 
 
 
 
 
 
 
462
 
463
+ prompt_template = """Analyze this teaching content with strict standards. Each criterion must meet specific requirements for a passing score.
464
 
465
  Score 1 ONLY if ALL requirements are met with clear evidence. Score 0 if ANY requirement is not fully met.
466
+ You MUST provide specific citations with timestamps [MM:SS] for each assessment point.
467
 
468
  Transcript:
469
  {transcript}
 
471
  Timestamp Instructions:
472
  {timestamp_instruction}
473
 
474
+ Required JSON response format:
475
+ {{
476
+ "Concept Assessment": {{
477
+ "Subject Matter Accuracy": {{
478
+ "Score": 0 or 1,
479
+ "Citations": ["[MM:SS] Exact quote showing evidence"]
480
+ }},
481
+ "First Principles Approach": {{
482
+ "Score": 0 or 1,
483
+ "Citations": ["[MM:SS] Exact quote showing evidence"]
484
+ }},
485
+ "Examples and Business Context": {{
486
+ "Score": 0 or 1,
487
+ "Citations": ["[MM:SS] Exact quote showing evidence"]
488
+ }},
489
+ "Cohesive Storytelling": {{
490
+ "Score": 0 or 1,
491
+ "Citations": ["[MM:SS] Exact quote showing evidence"]
492
+ }},
493
+ "Engagement and Interaction": {{
494
+ "Score": 0 or 1,
495
+ "Citations": ["[MM:SS] Exact quote showing evidence"]
496
+ }},
497
+ "Professional Tone": {{
498
+ "Score": 0 or 1,
499
+ "Citations": ["[MM:SS] Exact quote showing evidence"]
500
+ }}
501
+ }},
502
+ "Code Assessment": {{
503
+ "Depth of Explanation": {{
504
+ "Score": 0 or 1,
505
+ "Citations": ["[MM:SS] Exact quote showing evidence"]
506
+ }},
507
+ "Output Interpretation": {{
508
+ "Score": 0 or 1,
509
+ "Citations": ["[MM:SS] Exact quote showing evidence"]
510
+ }},
511
+ "Breaking down Complexity": {{
512
+ "Score": 0 or 1,
513
+ "Citations": ["[MM:SS] Exact quote showing evidence"]
514
+ }}
515
+ }}
516
+ }}
517
 
518
+ Scoring Criteria:
519
 
520
  Subject Matter Accuracy:
521
  βœ“ Score 1 if ALL:
522
+ - Demonstrates deep technical knowledge
523
+ - Uses precise terminology
524
+ - Explains concepts accurately
525
  βœ— Score 0 if ANY:
526
+ - Contains technical errors
527
+ - Uses imprecise terminology
528
+ - Misrepresents concepts
529
 
530
  First Principles Approach:
531
  βœ“ Score 1 if ALL:
532
  - Starts with fundamental concepts
533
  - Builds complexity systematically
534
+ - Shows clear concept relationships
535
  βœ— Score 0 if ANY:
536
+ - Skips fundamental concepts
537
+ - Presents concepts randomly
538
  - Missing logical progression
 
539
 
540
  Examples and Business Context:
541
  βœ“ Score 1 if ALL:
542
+ - Provides 2+ relevant examples
543
+ - Links to business applications
544
+ - Shows practical value
545
  βœ— Score 0 if ANY:
546
+ - Lacks concrete examples
547
+ - Missing business context
548
+ - Examples don't support learning
549
 
550
  Cohesive Storytelling:
551
  βœ“ Score 1 if ALL:
 
553
  - Logical topic transitions
554
  - Consistent theme throughout
555
  βœ— Score 0 if ANY:
556
+ - Disjointed presentation
557
  - Abrupt topic changes
558
+ - Lacks coherent flow
559
 
560
  Engagement and Interaction:
561
  βœ“ Score 1 if ALL:
562
+ - Asks engaging questions
563
+ - Encourages participation
564
+ - Responds to audience
565
  βœ— Score 0 if ANY:
 
566
  - One-way lecture style
567
+ - No audience interaction
568
+ - Ignores engagement opportunities
569
 
570
  Professional Tone:
571
  βœ“ Score 1 if ALL:
572
+ - Maintains formal language
573
+ - Speaks confidently
574
+ - Clear and articulate
575
  βœ— Score 0 if ANY:
576
+ - Uses casual language
577
+ - Shows uncertainty
578
+ - Unclear delivery
 
 
579
 
580
  Depth of Explanation:
581
  βœ“ Score 1 if ALL:
582
+ - Explains code purpose
583
  - Covers implementation details
584
+ - Discusses alternatives
585
  βœ— Score 0 if ANY:
586
  - Surface-level explanation
587
+ - Missing key details
588
+ - No alternative approaches
589
 
590
  Output Interpretation:
591
  βœ“ Score 1 if ALL:
592
+ - Explains expected results
593
+ - Covers error cases
594
+ - Discusses performance
595
  βœ— Score 0 if ANY:
596
  - Unclear output expectations
597
+ - No error handling
598
+ - Ignores performance
599
 
600
  Breaking down Complexity:
601
  βœ“ Score 1 if ALL:
602
+ - Divides complex concepts
603
+ - Step-by-step explanation
604
+ - Clear progression
605
  βœ— Score 0 if ANY:
606
  - Overwhelming complexity
607
+ - Missing steps
608
+ - Unclear progression
609
+
610
+ Important:
611
+ - Each citation must include timestamp and exact quote
612
+ - Score 1 requires meeting ALL criteria
613
+ - Score 0 if ANY criterion not met
614
+ - Use specific evidence from transcript"""
 
615
 
616
  return prompt_template.format(
617
  transcript=transcript,