Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
·
6305843
1
Parent(s):
23261da
default text-to-image
Browse files- ui/src/app/api/hf-jobs/route.ts +40 -13
ui/src/app/api/hf-jobs/route.ts
CHANGED
|
@@ -598,28 +598,55 @@ def generate_model_card_readme(repo_id: str, config: dict, model_name: str, cura
|
|
| 598 |
tags = []
|
| 599 |
lower_arch = (arch or "").lower()
|
| 600 |
lower_model_name = (model_config.get("name_or_path", "") or "").lower()
|
|
|
|
| 601 |
|
| 602 |
instruction_arches = {'flux_kontext', 'hidream_e1', 'qwen_image_edit'}
|
| 603 |
is_instruction = lower_arch in instruction_arches or 'kontext' in lower_model_name
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 604 |
|
| 605 |
datasets_config = config.get('config', {}).get('process', [{}])[0].get('datasets', [])
|
| 606 |
-
|
| 607 |
-
|
| 608 |
-
|
| 609 |
-
|
| 610 |
-
|
| 611 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 612 |
)
|
| 613 |
|
| 614 |
-
if
|
| 615 |
-
tags.append("image-to-image")
|
| 616 |
-
elif is_instruction:
|
| 617 |
tags.append("image-to-image")
|
| 618 |
elif is_video:
|
| 619 |
-
|
| 620 |
-
tags.append("image-to-video")
|
| 621 |
-
else:
|
| 622 |
-
tags.append("text-to-video")
|
| 623 |
else:
|
| 624 |
tags.append("text-to-image")
|
| 625 |
|
|
|
|
| 598 |
tags = []
|
| 599 |
lower_arch = (arch or "").lower()
|
| 600 |
lower_model_name = (model_config.get("name_or_path", "") or "").lower()
|
| 601 |
+
base_model_lower = (base_model or "").lower()
|
| 602 |
|
| 603 |
instruction_arches = {'flux_kontext', 'hidream_e1', 'qwen_image_edit'}
|
| 604 |
is_instruction = lower_arch in instruction_arches or 'kontext' in lower_model_name
|
| 605 |
+
is_edit_model = (
|
| 606 |
+
'edit' in lower_arch
|
| 607 |
+
or 'image_edit' in lower_arch
|
| 608 |
+
or 'edit' in lower_model_name
|
| 609 |
+
or 'image-edit' in lower_model_name
|
| 610 |
+
or 'edit' in base_model_lower
|
| 611 |
+
or 'image-edit' in base_model_lower
|
| 612 |
+
)
|
| 613 |
|
| 614 |
datasets_config = config.get('config', {}).get('process', [{}])[0].get('datasets', [])
|
| 615 |
+
sample_config = process_config.get('sample', {}) if isinstance(process_config, dict) else {}
|
| 616 |
+
sample_num_frames = sample_config.get('num_frames') if isinstance(sample_config, dict) else None
|
| 617 |
+
|
| 618 |
+
video_indicators = [
|
| 619 |
+
'video' in lower_arch,
|
| 620 |
+
'video' in lower_model_name,
|
| 621 |
+
'video' in base_model_lower,
|
| 622 |
+
't2v' in lower_arch,
|
| 623 |
+
't2v' in lower_model_name,
|
| 624 |
+
't2v' in base_model_lower,
|
| 625 |
+
'i2v' in lower_arch,
|
| 626 |
+
'i2v' in lower_model_name,
|
| 627 |
+
'i2v' in base_model_lower,
|
| 628 |
+
process_config.get('type') == 'video' if isinstance(process_config, dict) else False,
|
| 629 |
+
any(isinstance(dataset, dict) and dataset.get('do_i2v') for dataset in datasets_config),
|
| 630 |
+
isinstance(sample_num_frames, (int, float)) and sample_num_frames and sample_num_frames > 1,
|
| 631 |
+
lower_arch.startswith('wan'),
|
| 632 |
+
'wan' in lower_model_name,
|
| 633 |
+
'wan' in base_model_lower,
|
| 634 |
+
]
|
| 635 |
+
is_video = any(video_indicators)
|
| 636 |
+
is_i2v = any(
|
| 637 |
+
indicator
|
| 638 |
+
for indicator in [
|
| 639 |
+
'i2v' in lower_arch,
|
| 640 |
+
'i2v' in lower_model_name,
|
| 641 |
+
'i2v' in base_model_lower,
|
| 642 |
+
any(isinstance(dataset, dict) and dataset.get('do_i2v') for dataset in datasets_config),
|
| 643 |
+
]
|
| 644 |
)
|
| 645 |
|
| 646 |
+
if is_instruction or is_edit_model:
|
|
|
|
|
|
|
| 647 |
tags.append("image-to-image")
|
| 648 |
elif is_video:
|
| 649 |
+
tags.append("image-to-video" if is_i2v else "text-to-video")
|
|
|
|
|
|
|
|
|
|
| 650 |
else:
|
| 651 |
tags.append("text-to-image")
|
| 652 |
|