SightLine / app /vision /captioning.py
LovnishVerma's picture
Upload 41 files
a4cedc5 verified
Raw
History Blame Contribute Delete
408 Bytes
def format_caption(raw_caption: str) -> str:
"""Format raw scene descriptions for speech clarity."""
caption = raw_caption.strip()
if not caption:
return "I couldn't understand what's in the image."
# Capitalize first letter, ensure period at the end
if not caption.endswith('.'):
caption += '.'
caption = caption[0].upper() + caption[1:]
return caption