Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
·
d60ba5c
1
Parent(s):
c12ee07
fix tag again
Browse files- ui/src/app/api/hf-jobs/route.ts +24 -44
ui/src/app/api/hf-jobs/route.ts
CHANGED
|
@@ -606,60 +606,40 @@ def generate_model_card_readme(repo_id: str, config: dict, model_name: str, cura
|
|
| 606 |
else:
|
| 607 |
license_info = {"license": "creativeml-openrail-m"}
|
| 608 |
|
| 609 |
-
# Generate tags based on model architecture
|
| 610 |
tags = []
|
| 611 |
lower_arch = (arch or "").lower()
|
| 612 |
lower_model_name = (model_config.get("name_or_path", "") or "").lower()
|
| 613 |
base_model_lower = (base_model or "").lower()
|
| 614 |
|
| 615 |
-
|
| 616 |
-
|
| 617 |
-
|
| 618 |
-
|
| 619 |
-
or 'image_edit' in lower_arch
|
| 620 |
-
or 'edit' in lower_model_name
|
| 621 |
-
or 'image-edit' in lower_model_name
|
| 622 |
-
or 'edit' in base_model_lower
|
| 623 |
-
or 'image-edit' in base_model_lower
|
| 624 |
-
)
|
| 625 |
|
| 626 |
-
|
| 627 |
-
|
| 628 |
-
|
| 629 |
-
|
| 630 |
-
|
| 631 |
-
'
|
| 632 |
-
|
| 633 |
-
|
| 634 |
-
'
|
| 635 |
-
't2v'
|
| 636 |
-
|
| 637 |
-
'i2v' in lower_arch,
|
| 638 |
-
'i2v' in lower_model_name,
|
| 639 |
-
'i2v' in base_model_lower,
|
| 640 |
-
process_config.get('type') == 'video' if isinstance(process_config, dict) else False,
|
| 641 |
-
any(isinstance(dataset, dict) and dataset.get('do_i2v') for dataset in datasets_config),
|
| 642 |
-
isinstance(sample_num_frames, (int, float)) and sample_num_frames and sample_num_frames > 1,
|
| 643 |
-
lower_arch.startswith('wan'),
|
| 644 |
-
'wan' in lower_model_name,
|
| 645 |
-
'wan' in base_model_lower,
|
| 646 |
-
]
|
| 647 |
-
is_video = any(video_indicators)
|
| 648 |
-
is_i2v = any(
|
| 649 |
-
indicator
|
| 650 |
-
for indicator in [
|
| 651 |
-
'i2v' in lower_arch,
|
| 652 |
-
'i2v' in lower_model_name,
|
| 653 |
-
'i2v' in base_model_lower,
|
| 654 |
-
any(isinstance(dataset, dict) and dataset.get('do_i2v') for dataset in datasets_config),
|
| 655 |
-
]
|
| 656 |
-
)
|
| 657 |
|
| 658 |
-
|
|
|
|
| 659 |
tags.append("image-to-image")
|
| 660 |
-
elif
|
|
|
|
|
|
|
| 661 |
tags.append("image-to-video" if is_i2v else "text-to-video")
|
|
|
|
|
|
|
| 662 |
else:
|
|
|
|
| 663 |
tags.append("text-to-image")
|
| 664 |
|
| 665 |
if "xl" in lower_arch:
|
|
|
|
| 606 |
else:
|
| 607 |
license_info = {"license": "creativeml-openrail-m"}
|
| 608 |
|
| 609 |
+
# Generate tags based on model architecture group
|
| 610 |
tags = []
|
| 611 |
lower_arch = (arch or "").lower()
|
| 612 |
lower_model_name = (model_config.get("name_or_path", "") or "").lower()
|
| 613 |
base_model_lower = (base_model or "").lower()
|
| 614 |
|
| 615 |
+
# Define model groups based on the frontend options.ts structure
|
| 616 |
+
# Group: 'image' -> text-to-image
|
| 617 |
+
# Group: 'instruction' -> image-to-image
|
| 618 |
+
# Group: 'video' -> check for i2v in arch name for image-to-video vs text-to-video
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 619 |
|
| 620 |
+
image_arches = {
|
| 621 |
+
'flux', 'flex1', 'flex2', 'chroma', 'lumina2',
|
| 622 |
+
'qwen_image', 'hidream', 'sdxl', 'sd15', 'omnigen2'
|
| 623 |
+
}
|
| 624 |
+
instruction_arches = {
|
| 625 |
+
'flux_kontext', 'qwen_image_edit', 'qwen_image_edit_plus', 'hidream_e1'
|
| 626 |
+
}
|
| 627 |
+
video_arches = {
|
| 628 |
+
'wan21:1b', 'wan21_i2v:14b480p', 'wan21_i2v:14b', 'wan21:14b',
|
| 629 |
+
'wan22_14b:t2v', 'wan22_14b_i2v', 'wan22_5b'
|
| 630 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 631 |
|
| 632 |
+
# Determine the task type based on architecture group
|
| 633 |
+
if lower_arch in instruction_arches:
|
| 634 |
tags.append("image-to-image")
|
| 635 |
+
elif lower_arch in video_arches:
|
| 636 |
+
# Video models: check if i2v is in the architecture name
|
| 637 |
+
is_i2v = 'i2v' in lower_arch
|
| 638 |
tags.append("image-to-video" if is_i2v else "text-to-video")
|
| 639 |
+
elif lower_arch in image_arches:
|
| 640 |
+
tags.append("text-to-image")
|
| 641 |
else:
|
| 642 |
+
# Fallback to text-to-image for unknown architectures
|
| 643 |
tags.append("text-to-image")
|
| 644 |
|
| 645 |
if "xl" in lower_arch:
|