Miquel Farre commited on
Commit
b575ddb
·
1 Parent(s): 524fae7

two highlights path

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -87,8 +87,13 @@ class VideoHighlightDetector:
87
  """Determine what constitutes highlights based on video description with different prompts."""
88
  system_prompts = {
89
  1: "You are a highlight editor. List archetypal dramatic moments that would make compelling highlights if they appear in the video. Each moment should be specific enough to be recognizable but generic enough to potentially exist in any video of this type.",
90
- 2: "You are a highlight editor focusing on subtle and nuanced moments. List quieter, character-driven, or atmospheric moments that would make interesting highlights. Focus on moments that might be overlooked by traditional highlight detection but add depth to the story."
91
  }
 
 
 
 
 
92
 
93
  messages = [
94
  {
@@ -97,7 +102,7 @@ class VideoHighlightDetector:
97
  },
98
  {
99
  "role": "user",
100
- "content": [{"type": "text", "text": f"""Here is a description of a video:\n\n{video_description}\n\nList potential highlight moments to look for in this video:"""}]
101
  }
102
  ]
103
 
@@ -290,7 +295,7 @@ def create_ui(examples_path: str, model_path: str):
290
 
291
  detector = VideoHighlightDetector(
292
  model_path=model_path,
293
- batch_size=8
294
  )
295
 
296
  yield [
@@ -329,7 +334,6 @@ def create_ui(examples_path: str, model_path: str):
329
  total_segments = int(duration / segment_length)
330
 
331
  for start_time in range(0, int(duration), int(segment_length)):
332
- segments_processed += 1
333
  progress = int((segments_processed / total_segments) * 100)
334
 
335
  yield [
@@ -368,6 +372,8 @@ def create_ui(examples_path: str, model_path: str):
368
 
369
  # Clean up segment file
370
  os.remove(segment_path)
 
 
371
 
372
  # Remove temp directory
373
  os.rmdir(temp_dir)
 
87
  """Determine what constitutes highlights based on video description with different prompts."""
88
  system_prompts = {
89
  1: "You are a highlight editor. List archetypal dramatic moments that would make compelling highlights if they appear in the video. Each moment should be specific enough to be recognizable but generic enough to potentially exist in any video of this type.",
90
+ 2: "You are a helpful visual-language assistant that can understand videos and edit. You are tasked helping the user to create highlight reels for videos. Generally, highlights should be relatively rare and important events in the video in question."
91
  }
92
+ user_prompts = {
93
+ 1: "List potential highlight moments to look for in this video:",
94
+ 2: "List dramatic moments that would make compelling highlights if they appear in the video. Each moment should be specific enough to be recognizable but generic enough to potentially exist in any video of this type:"
95
+ }
96
+
97
 
98
  messages = [
99
  {
 
102
  },
103
  {
104
  "role": "user",
105
+ "content": [{"type": "text", "text": f"""Here is a description of a video:\n\n{video_description}\n\n{user_prompts[prompt_num]}"""}]
106
  }
107
  ]
108
 
 
295
 
296
  detector = VideoHighlightDetector(
297
  model_path=model_path,
298
+ batch_size=16
299
  )
300
 
301
  yield [
 
334
  total_segments = int(duration / segment_length)
335
 
336
  for start_time in range(0, int(duration), int(segment_length)):
 
337
  progress = int((segments_processed / total_segments) * 100)
338
 
339
  yield [
 
372
 
373
  # Clean up segment file
374
  os.remove(segment_path)
375
+ segments_processed += 1
376
+
377
 
378
  # Remove temp directory
379
  os.rmdir(temp_dir)