Spaces:
Sleeping
Sleeping
Download src/vision/captioning.py from LovnishVerma/SightLine: direct link, hf CLI and curl.
- Browser
- Download file 420 Bytes
-
https://huggingface.co/spaces/LovnishVerma/SightLine/resolve/main/src/vision/captioning.py
- Command line
-
hf download hf://spaces/LovnishVerma/SightLine/src/vision/captioning.py
-
curl -L -o captioning.py https://huggingface.co/spaces/LovnishVerma/SightLine/resolve/main/src/vision/captioning.py
420 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 | |