apolinario commited on
Commit
d60ba5c
·
1 Parent(s): c12ee07

fix tag again

Browse files
Files changed (1) hide show
  1. 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
- instruction_arches = {'flux_kontext', 'hidream_e1', 'qwen_image_edit', 'qwen_image_edit_plus'}
616
- is_instruction = lower_arch in instruction_arches or 'kontext' in lower_model_name
617
- is_edit_model = (
618
- 'edit' in lower_arch
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
- datasets_config = config.get('config', {}).get('process', [{}])[0].get('datasets', [])
627
- sample_config = process_config.get('sample', {}) if isinstance(process_config, dict) else {}
628
- sample_num_frames = sample_config.get('num_frames') if isinstance(sample_config, dict) else None
629
-
630
- video_indicators = [
631
- 'video' in lower_arch,
632
- 'video' in lower_model_name,
633
- 'video' in base_model_lower,
634
- 't2v' in lower_arch,
635
- 't2v' in lower_model_name,
636
- 't2v' in base_model_lower,
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
- if is_instruction or is_edit_model:
 
659
  tags.append("image-to-image")
660
- elif is_video:
 
 
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: