Spaces:
Build error
Build error
Download src/ingestion/caption_extractor.py from AdarshDS/ThesisBackend: direct link, hf CLI and curl.
- Browser
- Download file 267 Bytes
-
https://huggingface.co/spaces/AdarshDS/ThesisBackend/resolve/main/src/ingestion/caption_extractor.py
- Command line
-
hf download hf://spaces/AdarshDS/ThesisBackend/src/ingestion/caption_extractor.py
-
curl -L -o caption_extractor.py https://huggingface.co/spaces/AdarshDS/ThesisBackend/resolve/main/src/ingestion/caption_extractor.py
267 Bytes
| import re | |
| CAPTION_PATTERN = r"(Figure\s+\d+(?:\.\d+)?[:.]?\s.*)" | |
| def extract_caption(text: str): | |
| if not text: | |
| return None | |
| match = re.search(CAPTION_PATTERN, text, re.IGNORECASE) | |
| if match: | |
| return match.group(1).strip() | |
| return None |