Spaces:
Sleeping
Sleeping
File size: 611 Bytes
c25654b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
from app.utils import extract_keyframes, detect_timestamp
from pathlib import Path
def process_input_file(filepath, metadata):
path = Path(filepath)
keyframes = extract_keyframes(path) # Extract frames from the video (if needed), or simply return the original image
for frame in keyframes:
result = detect_timestamp(
image_path=frame,
metadata=metadata
)
if result and result.get("timestamp"):
return result
return {
"timestamp": None,
"source": None,
"confidence": 0.0,
"keyframe_file": None
} |