Spaces:
Sleeping
Sleeping
commit 3
Browse files- app.py +6 -2
- huggingface_exact_approach.py +13 -11
app.py
CHANGED
|
@@ -64,7 +64,6 @@ if MODEL_DEVICE not in {"auto", "cpu", "cuda", "mps"}:
|
|
| 64 |
class AnalysisResponse(BaseModel):
|
| 65 |
success: bool
|
| 66 |
message: str
|
| 67 |
-
job_id: str
|
| 68 |
video_description: str
|
| 69 |
highlights: str
|
| 70 |
analysis_file: str
|
|
@@ -263,6 +262,12 @@ async def upload_video(
|
|
| 263 |
if not enriched_description:
|
| 264 |
enriched_description = base_desc
|
| 265 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 266 |
results["video_description"] = enriched_description
|
| 267 |
with open(analysis_path, "w") as f:
|
| 268 |
json.dump(results, f, indent=2)
|
|
@@ -270,7 +275,6 @@ async def upload_video(
|
|
| 270 |
return AnalysisResponse(
|
| 271 |
success=True,
|
| 272 |
message="Video description generated successfully",
|
| 273 |
-
job_id=job_id,
|
| 274 |
video_description=enriched_description,
|
| 275 |
highlights=f"/tmp/outputs/{output_filename}",
|
| 276 |
analysis_file=f"/tmp/outputs/{analysis_filename}",
|
|
|
|
| 64 |
class AnalysisResponse(BaseModel):
|
| 65 |
success: bool
|
| 66 |
message: str
|
|
|
|
| 67 |
video_description: str
|
| 68 |
highlights: str
|
| 69 |
analysis_file: str
|
|
|
|
| 262 |
if not enriched_description:
|
| 263 |
enriched_description = base_desc
|
| 264 |
|
| 265 |
+
logger.info(
|
| 266 |
+
"API response selected_set=%s video_description=%s",
|
| 267 |
+
selected_set or "fallback",
|
| 268 |
+
enriched_description,
|
| 269 |
+
)
|
| 270 |
+
|
| 271 |
results["video_description"] = enriched_description
|
| 272 |
with open(analysis_path, "w") as f:
|
| 273 |
json.dump(results, f, indent=2)
|
|
|
|
| 275 |
return AnalysisResponse(
|
| 276 |
success=True,
|
| 277 |
message="Video description generated successfully",
|
|
|
|
| 278 |
video_description=enriched_description,
|
| 279 |
highlights=f"/tmp/outputs/{output_filename}",
|
| 280 |
analysis_file=f"/tmp/outputs/{analysis_filename}",
|
huggingface_exact_approach.py
CHANGED
|
@@ -165,17 +165,19 @@ class VideoHighlightDetector:
|
|
| 165 |
"content": [{
|
| 166 |
"type": "text",
|
| 167 |
"text": (
|
| 168 |
-
"
|
| 169 |
-
"
|
|
|
|
| 170 |
"Include:\n"
|
| 171 |
-
"-
|
| 172 |
-
"- The
|
| 173 |
-
"-
|
| 174 |
-
"-
|
| 175 |
-
"
|
| 176 |
-
"Do
|
| 177 |
-
"
|
| 178 |
-
|
|
|
|
| 179 |
)
|
| 180 |
}]
|
| 181 |
}
|
|
@@ -202,7 +204,7 @@ class VideoHighlightDetector:
|
|
| 202 |
"role": "user",
|
| 203 |
"content": [
|
| 204 |
{"type": "video", "path": clip_path},
|
| 205 |
-
{"type": "text", "text": "Write exactly
|
| 206 |
]
|
| 207 |
}
|
| 208 |
]
|
|
|
|
| 165 |
"content": [{
|
| 166 |
"type": "text",
|
| 167 |
"text": (
|
| 168 |
+
"You are reporting live from the scene.\n\n"
|
| 169 |
+
"In 4–5 complete sentences, describe exactly what is happening.\n"
|
| 170 |
+
"Capture the key visible moments as they unfold.\n\n"
|
| 171 |
"Include:\n"
|
| 172 |
+
"- Who is present and what they are doing\n"
|
| 173 |
+
"- The environment or location\n"
|
| 174 |
+
"- Visible reactions, gestures, or interactions\n"
|
| 175 |
+
"- Any significant action or change during the clip\n\n"
|
| 176 |
+
"Keep the tone natural, clear, and factual.\n"
|
| 177 |
+
"Do not speculate.\n"
|
| 178 |
+
"Do not mention the recording device.\n\n"
|
| 179 |
+
"Use only these observed details:\n"
|
| 180 |
+
f"{draft}"
|
| 181 |
)
|
| 182 |
}]
|
| 183 |
}
|
|
|
|
| 204 |
"role": "user",
|
| 205 |
"content": [
|
| 206 |
{"type": "video", "path": clip_path},
|
| 207 |
+
{"type": "text", "text": "Write exactly 3-4 factual sentences about what is visually happening."}
|
| 208 |
]
|
| 209 |
}
|
| 210 |
]
|