factorstudios commited on
Commit
2133b69
·
verified ·
1 Parent(s): 63a4b52

Update server.py

Browse files
Files changed (1) hide show
  1. server.py +38 -21
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 a movie marketing expert who identifies the most engaging and thrilling segments of movies.
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
- IMPORTANT:
156
- - You MUST respond with a valid JSON array ONLY. Do not include any text before or after the JSON array.
157
- - Each segment should be approximately 10 MINUTES LONG (600 seconds)
158
- - End time = Start time + ~10 minutes
 
 
 
159
 
160
- Each segment must have:
161
- - segment_number: (1-10)
162
- - title: (engaging, compelling title for this moment)
163
- - start_time: (HH:MM:SS format - when this segment starts)
164
- - end_time: (HH:MM:SS format - when this segment ends, approximately 10 minutes after start)
165
- - description: (brief description of why this is engaging)
166
- - engagement_level: (high/medium)
167
- - reason: (one-line reason this will hook viewers)
168
 
169
- Return ONLY the JSON array. Example format:
 
 
 
 
 
 
 
 
 
170
  [
171
- {"segment_number": 1, "title": "Epic Action Scene", "start_time": "00:15:30", "end_time": "00:25:30", "description": "...", "engagement_level": "high", "reason": "..."},
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"""Please extract exactly 10 of the most engaging segments from this movie transcript.
 
 
 
 
 
 
 
177
 
178
- TRANSCRIPT:
179
- {transcript_content[:15000]}
180
 
181
- Return a JSON array with exactly 10 segments following the format specified. Each segment must have accurate start and end times from the transcript."""
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(