Download src/util/extract.py from UNIQ-DEV/Image-Classification-Benchmark: direct link, hf CLI and curl.
- Browser
- Download file 340 Bytes
-
https://huggingface.co/spaces/UNIQ-DEV/Image-Classification-Benchmark/resolve/main/src/util/extract.py
- Command line
-
hf download hf://spaces/UNIQ-DEV/Image-Classification-Benchmark/src/util/extract.py
-
curl -L -o extract.py https://huggingface.co/spaces/UNIQ-DEV/Image-Classification-Benchmark/resolve/main/src/util/extract.py
340 Bytes
| import re | |
| def extract_image_urls(text): | |
| # Regular expression to match image URLs | |
| pattern = re.compile(r'https?://[^\s]+\.jpg|https?://[^\s]+\.jpeg|https?://[^\s]+\.png|https?://[^\s]+\.gif|https?://[^\s]+\.bmp|https?://[^\s]+\.webp') | |
| # Find all matches in the input text | |
| matches = pattern.findall(text) | |
| return matches |