File size: 420 Bytes
88fe4e7
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
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