Local models: the folder's README.md is the model card

The worker reads README.md when it scans the models folder (the web
app can't see it) and stores it on the folder and, after import, on
the model; every scan refreshes it for local models. Relative images
and links are dropped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Pascal LinxweilerandClaude Opus 5.5 committed 2026-11-08 00:27:17 +01:00
1 parent 5a8893e7db
commit d27e79bba0
10 files changed
+1660 -17

No files matched your search

+11 -8
View File
@@ -38,7 +38,7 @@ import { DownloadCard } from "./download-card";
import { FilesTab } from "./files-tab";
import { HubCheckButton } from "./hub-check";
import { JobsTab } from "./jobs-tab";
import { ModelCardSection, ModelCardSkeleton } from "./model-card";
import { LocalModelCardSection, ModelCardSection, ModelCardSkeleton } from "./model-card";
import { DeleteModelButton } from "./delete-model-button";
import { TagEditor } from "./tag-editor";
import { UpdateBanner } from "./update-banner";
@@ -93,10 +93,9 @@ export default async function ModelPage({ params, searchParams }: PageProps<"/[o
const { model, files } = data;
if (model.repoId !== `${org}/${repo}`) redirect(`/${model.repoId}`); // canonical spelling
// A local model has no Hub repo: no model card, commit, Hub checks or model tree.
// A local model has no Hub repo: no commit, Hub checks or model tree; its README is the model card.
const local = model.source === "local";
const tabs = local ? TABS.filter((t) => t.id !== "card") : TABS;
const tab: TabId = tabs.some((t) => t.id === sp.tab) ? (sp.tab as TabId) : "files";
const tab: TabId = TABS.some((t) => t.id === sp.tab) ? (sp.tab as TabId) : "files";
const [author, name] = model.repoId.split("/");
const hub = `https://huggingface.co/${model.repoId}`;
const baseModels = model.baseModels ?? [];
@@ -237,7 +236,7 @@ export default async function ModelPage({ params, searchParams }: PageProps<"/[o
<Panel className="min-w-0 overflow-hidden">
<div className="flex flex-wrap items-center justify-between gap-2 border-b px-4 py-3">
<nav className="inline-flex rounded-lg bg-muted p-1">
{tabs.map((t) => (
{TABS.map((t) => (
<Link
key={t.id}
href={tabHref(t.id)}
@@ -265,9 +264,13 @@ export default async function ModelPage({ params, searchParams }: PageProps<"/[o
{tab === "card" && (
<div className="p-5 sm:p-6">
<Suspense fallback={<ModelCardSkeleton />}>
<ModelCardSection repoId={model.repoId} sha={model.pinnedSha} />
</Suspense>
{local ? (
<LocalModelCardSection markdown={model.localReadme} localPath={model.localPath} />
) : (
<Suspense fallback={<ModelCardSkeleton />}>
<ModelCardSection repoId={model.repoId} sha={model.pinnedSha} />
</Suspense>
)}
</div>
)}
{tab === "files" && (