Spaces:
Sleeping
Sleeping
Update huggingface_exact_approach.py
Browse files
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.
|
| 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": "
|
| 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.
|
| 99 |
-
2: "You are a
|
| 100 |
}
|
| 101 |
user_prompts = {
|
| 102 |
-
1: "
|
| 103 |
-
2: "
|
| 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()
|