LogicGoInfotechSpaces commited on
Commit
ff6bec8
·
verified ·
1 Parent(s): bb657cb

Update huggingface_exact_approach.py

Browse files
Files changed (1) hide show
  1. huggingface_exact_approach.py +7 -7
huggingface_exact_approach.py CHANGED
@@ -66,7 +66,7 @@ class VideoHighlightDetector:
66
 
67
  def analyze_video_content(self, video_path: str) -> str:
68
  """Analyze video content to determine its type and description."""
69
- system_message = "You are a helpful assistant that can understand videos. Describe what type of video this is and what's happening in it."
70
  messages = [
71
  {
72
  "role": "system",
@@ -76,7 +76,7 @@ class VideoHighlightDetector:
76
  "role": "user",
77
  "content": [
78
  {"type": "video", "path": video_path},
79
- {"type": "text", "text": "What type of video is this and what's happening in it? Be specific about the content type and general activities you observe."}
80
  ]
81
  }
82
  ]
@@ -95,12 +95,12 @@ class VideoHighlightDetector:
95
  def determine_highlights(self, video_description: str, prompt_num: int = 1) -> str:
96
  """Determine what constitutes highlights based on video description with different prompts."""
97
  system_prompts = {
98
- 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 other videos of this type.",
99
- 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. Highlights should be rare and important events in the video in question."
100
  }
101
  user_prompts = {
102
- 1: "List potential highlight moments to look for in this video:",
103
- 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:"
104
  }
105
 
106
 
@@ -522,4 +522,4 @@ def main():
522
  traceback.print_exc()
523
 
524
  if __name__ == "__main__":
525
- main()
 
66
 
67
  def analyze_video_content(self, video_path: str) -> str:
68
  """Analyze video content to determine its type and description."""
69
+ system_message = "You are a helpful assistant that can understand videos. Give a concise, accurate 4-5 sentence description."
70
  messages = [
71
  {
72
  "role": "system",
 
76
  "role": "user",
77
  "content": [
78
  {"type": "video", "path": video_path},
79
+ {"type": "text", "text": "Describe this video in 4-5 sentences. Be accurate, concrete, and avoid guessing names/places unless clearly visible."}
80
  ]
81
  }
82
  ]
 
95
  def determine_highlights(self, video_description: str, prompt_num: int = 1) -> str:
96
  """Determine what constitutes highlights based on video description with different prompts."""
97
  system_prompts = {
98
+ 1: "You are a highlight editor. Return exactly 4-5 sentences describing the most important highlight moments to look for. Be specific, realistic, and avoid fabricated names or places.",
99
+ 2: "You are a visual-language assistant for creating highlight reels. Return exactly 4-5 sentences describing rare, important highlight-worthy moments. Be concrete and avoid invented details."
100
  }
101
  user_prompts = {
102
+ 1: "Based on this video description, describe the top highlight moments to look for in exactly 4-5 sentences.",
103
+ 2: "Based on this video description, describe dramatic moments that would make compelling highlights in exactly 4-5 sentences."
104
  }
105
 
106
 
 
522
  traceback.print_exc()
523
 
524
  if __name__ == "__main__":
525
+ main()