vidhi0405 commited on
Commit
a18a676
·
1 Parent(s): c3d87b5
Files changed (2) hide show
  1. app.py +6 -2
  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
- "Describe the video in 4-5 clear, complete sentences.\n"
169
- "Focus only on what is visually happening on screen.\n\n"
 
170
  "Include:\n"
171
- "- The main subjects and their actions\n"
172
- "- The setting or environment\n"
173
- "- Any visible emotions, gestures, or interactions\n"
174
- "- Important changes or events during the clip\n\n"
175
- "Do NOT add assumptions, opinions, or unseen context.\n"
176
- "Do NOT mention the camera, audio, or that this is a video.\n"
177
- "Write in simple, factual, neutral language.\n\n"
178
- f"Use this draft as source facts only:\n{draft}"
 
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 one factual sentence about what is visually happening."}
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
  ]