Skip to content

Commit

Permalink
Merge pull request #49 from lehors/fix_config
Browse files Browse the repository at this point in the history
Add github and huggingface URLs only if they are set
  • Loading branch information
lehors authored Nov 14, 2024
2 parents e51ec7e + cb00be8 commit c8e5b77
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions web/modules/mof/src/ModelSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,16 @@ private function processModel(ModelInterface $model): array {
'origin' => $model->getOrigin() ?? '',
'producer' => $model->getOrganization() ?? '',
'contact' => $owner->id() > 1 ? $owner->getEmail() : '',
'github' => $model->getGithubSlug() ? 'https://github.com/' . $model->getGithubSlug() : '',
'huggingface' => $model->getHuggingfaceSlug() ? 'https://huggingface.co/' . $model->getHuggingfaceSlug() : '',
],
];

if ($model->getGithubSlug()) {
$data['release']['github'] = 'https://github.com/' . $model->getGithubSlug();
}
if ($model->getHuggingfaceSlug()) {
$data['release']['huggingface'] = 'https://huggingface.co/' . $model->getHuggingfaceSlug();
}

$completed = array_filter(
$this->componentManager->getComponents(),
fn($c) => in_array($c->id, $model->getCompletedComponents()));
Expand Down

0 comments on commit c8e5b77

Please sign in to comment.