| 13 | from settings import PROJECT_MAX_PORT, PROJECT_MIN_PORT, PROJECTS_DIR |
| 14 | |
| 15 | def check_url_structure(url): |
| 16 | # Check for huggingface.co URL structure |
| 17 | huggingface_pattern = r'^https://huggingface\.co/[\w-]+/[\w-]+/blob/[\w-]+\.(safetensors|bin|ckpt)$' |
| 18 | if re.match(huggingface_pattern, url): |
| 19 | return True |
| 20 | |
| 21 | # Check for civitai.com URL structure |
| 22 | civitai_pattern = r'^https://civitai\.com/models/\d+$' |
| 23 | if re.match(civitai_pattern, url): |
| 24 | return True |
| 25 | |
| 26 | return False |
| 27 | |
| 28 | def slugify(value, allow_unicode=False): |
| 29 | """ |