Spaces:
Sleeping
Sleeping
Update server.py
Browse files
server.py
CHANGED
|
@@ -149,36 +149,53 @@ async def process_transcription_for_highlights(
|
|
| 149 |
)
|
| 150 |
|
| 151 |
# Create structured prompt for segment extraction
|
| 152 |
-
system_prompt = """You are
|
| 153 |
-
You will receive a full movie transcript with timestamps. Your task is to identify exactly 10 of the most compelling moments that would make audiences want to watch the full movie.
|
| 154 |
|
| 155 |
-
|
| 156 |
-
-
|
| 157 |
-
-
|
| 158 |
-
-
|
|
|
|
|
|
|
|
|
|
| 159 |
|
| 160 |
-
|
| 161 |
-
-
|
| 162 |
-
-
|
| 163 |
-
-
|
| 164 |
-
-
|
| 165 |
-
-
|
| 166 |
-
-
|
| 167 |
-
-
|
| 168 |
|
| 169 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
[
|
| 171 |
-
{"segment_number": 1, "title": "
|
| 172 |
-
{"segment_number": 2, "title": "Emotional Climax", "start_time": "00:45:12", "end_time": "00:55:12", "description": "...", "engagement_level": "high", "reason": "..."}
|
| 173 |
]
|
| 174 |
"""
|
| 175 |
|
| 176 |
-
user_message = f"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
|
| 178 |
-
TRANSCRIPT:
|
| 179 |
-
{transcript_content
|
| 180 |
|
| 181 |
-
Return
|
| 182 |
|
| 183 |
print("Sending transcript to LLM for highlight extraction...")
|
| 184 |
response = client.chat.completions.create(
|
|
|
|
| 149 |
)
|
| 150 |
|
| 151 |
# Create structured prompt for segment extraction
|
| 152 |
+
system_prompt = """You are an expert film editor and marketing strategist who identifies KEY MOMENTS from movies that make viewers WANT to watch the entire film.
|
|
|
|
| 153 |
|
| 154 |
+
Your task: Analyze the full movie transcript and identify exactly 10 HIGH-IMPACT moments that would serve as compelling hooks to attract audiences. These should be:
|
| 155 |
+
- Plot turning points / major story beats
|
| 156 |
+
- Action sequences / high tension moments
|
| 157 |
+
- Emotional climaxes / character breakthroughs
|
| 158 |
+
- Shocking reveals / plot twists
|
| 159 |
+
- Character introductions / pivotal interactions
|
| 160 |
+
- Climactic confrontations or resolutions
|
| 161 |
|
| 162 |
+
CRITICAL REQUIREMENTS:
|
| 163 |
+
- You MUST respond with ONLY a valid JSON array. NO text before or after.
|
| 164 |
+
- DO NOT arrange segments by time order - arrange them by ENGAGEMENT and IMPACT level
|
| 165 |
+
- Segments can start ANYWHERE in the movie (5 min, 40 min, 90 min - doesn't matter)
|
| 166 |
+
- Each segment should be 8-15 MINUTES LONG to capture the complete moment with context
|
| 167 |
+
- Include exact timestamps from the transcript
|
| 168 |
+
- Prioritize QUALITY over chronology - pick genuinely attention-grabbing moments
|
| 169 |
+
- Segment 1 = MOST IMPACTFUL, Segment 10 = still engaging but slightly less
|
| 170 |
|
| 171 |
+
Each segment must include:
|
| 172 |
+
- segment_number: (1-10, ranked by engagement level, NOT by time)
|
| 173 |
+
- title: (compelling, hooks viewers immediately)
|
| 174 |
+
- start_time: (HH:MM:SS - exact start from transcript, can be anywhere)
|
| 175 |
+
- end_time: (HH:MM:SS - exact end from transcript, captures full moment)
|
| 176 |
+
- description: (2-3 sentences explaining why this moment is essential)
|
| 177 |
+
- engagement_level: (high/medium - high for critical moments)
|
| 178 |
+
- reason: (one line hook - what makes viewers want MORE)
|
| 179 |
+
|
| 180 |
+
JSON format:
|
| 181 |
[
|
| 182 |
+
{"segment_number": 1, "title": "...", "start_time": "HH:MM:SS", "end_time": "HH:MM:SS", "description": "...", "engagement_level": "high", "reason": "..."}
|
|
|
|
| 183 |
]
|
| 184 |
"""
|
| 185 |
|
| 186 |
+
user_message = f"""Analyze this COMPLETE movie transcript and extract exactly 10 KEY MOMENTS that would make someone want to watch the full film.
|
| 187 |
+
|
| 188 |
+
IMPORTANT: Do NOT arrange segments by when they appear in the movie. Arrange them by IMPACT and ENGAGEMENT.
|
| 189 |
+
- A key scene at 40 minutes into the movie can be segment 1 if it's the most engaging
|
| 190 |
+
- A scene at 10 minutes can be segment 8 if it's less impactful
|
| 191 |
+
- Order by viewer attention level, NOT by timeline
|
| 192 |
+
|
| 193 |
+
Find the 10 best moments regardless of where they fall in the runtime.
|
| 194 |
|
| 195 |
+
FULL TRANSCRIPT:
|
| 196 |
+
{transcript_content}
|
| 197 |
|
| 198 |
+
Return ONLY the JSON array with exactly 10 segments ranked by engagement level."""
|
| 199 |
|
| 200 |
print("Sending transcript to LLM for highlight extraction...")
|
| 201 |
response = client.chat.completions.create(
|