Populates the `model_card` with library name and optional tags.
(model_card: ModelCard, tags: Union[str, List[str]] = None)
| 167 | |
| 168 | |
| 169 | def populate_model_card(model_card: ModelCard, tags: Union[str, List[str]] = None) -> ModelCard: |
| 170 | """Populates the `model_card` with library name and optional tags.""" |
| 171 | if model_card.data.library_name is None: |
| 172 | model_card.data.library_name = "diffusers" |
| 173 | |
| 174 | if tags is not None: |
| 175 | if isinstance(tags, str): |
| 176 | tags = [tags] |
| 177 | if model_card.data.tags is None: |
| 178 | model_card.data.tags = [] |
| 179 | for tag in tags: |
| 180 | model_card.data.tags.append(tag) |
| 181 | |
| 182 | return model_card |
| 183 | |
| 184 | |
| 185 | def extract_commit_hash(resolved_file: Optional[str], commit_hash: Optional[str] = None): |
no outgoing calls