Spaces:
Running
Running
Update src/aibom_generator/generator.py
Browse files
src/aibom_generator/generator.py
CHANGED
@@ -97,6 +97,7 @@ class AIBOMGenerator:
|
|
97 |
"downloads": model_info.downloads if hasattr(model_info, "downloads") else 0,
|
98 |
"last_modified": model_info.lastModified if hasattr(model_info, "lastModified") else None,
|
99 |
"commit": model_info.sha[:7] if hasattr(model_info, "sha") and model_info.sha else None,
|
|
|
100 |
})
|
101 |
|
102 |
if model_card and model_card.data:
|
@@ -189,10 +190,16 @@ class AIBOMGenerator:
|
|
189 |
if "license" in metadata:
|
190 |
component["licenses"] = [{"license": {"id": metadata["license"]}}]
|
191 |
|
192 |
-
|
193 |
"type": "website",
|
194 |
"url": f"https://huggingface.co/{model_id}"
|
195 |
}]
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
|
197 |
component["modelCard"] = self._create_model_card_section(metadata)
|
198 |
|
|
|
97 |
"downloads": model_info.downloads if hasattr(model_info, "downloads") else 0,
|
98 |
"last_modified": model_info.lastModified if hasattr(model_info, "lastModified") else None,
|
99 |
"commit": model_info.sha[:7] if hasattr(model_info, "sha") and model_info.sha else None,
|
100 |
+
"commit_url": f"https://huggingface.co/{model_id}/commit/{model_info.sha}" if hasattr(model_info, "sha") and model_info.sha else None,
|
101 |
})
|
102 |
|
103 |
if model_card and model_card.data:
|
|
|
190 |
if "license" in metadata:
|
191 |
component["licenses"] = [{"license": {"id": metadata["license"]}}]
|
192 |
|
193 |
+
external_refs = [{
|
194 |
"type": "website",
|
195 |
"url": f"https://huggingface.co/{model_id}"
|
196 |
}]
|
197 |
+
if "commit_url" in metadata:
|
198 |
+
external_refs.append({
|
199 |
+
"type": "vcs",
|
200 |
+
"url": metadata["commit_url"]
|
201 |
+
})
|
202 |
+
component["externalReferences"] = external_refs
|
203 |
|
204 |
component["modelCard"] = self._create_model_card_section(metadata)
|
205 |
|