browser / README.md
lrigamai's picture
Group LoRAs by character, add table view and docked detail panel
45fb44a
|
Raw History Blame Contribute Delete
2.41 kB
---
title: LoRA Browser
emoji: 🪷
colorFrom: gray
colorTo: green
short_description: Browse lrigamai's character LoRAs by base model
sdk: static
app_file: dist/index.html
pinned: false
license: apache-2.0
---
# LoRA Browser
Static Space that lists the LoRAs in [`lrigamai/loras`](https://huggingface.co/lrigamai/loras), grouped by base model. Vue 3 + TypeScript + Vite. The built `dist/` is committed and served as plain static files.
```bash
pnpm install
pnpm dev # local dev server
pnpm dev:mock # same, plus a fake second base model to try multi-model layouts
pnpm build # typecheck + build to dist/
```
**Deploying:** the Space serves the committed `dist/` folder directly (`app_file: dist/index.html`). The Hub's build step costs credits, so there's no `app_build_command`. After changing anything in `src/`, rebuild and commit `dist/` along with the source:
```bash
pnpm build && git add -A && git commit -m "…" && git push
```
## Where the data comes from
Nothing is hand-maintained. On load, the page reads the repo through the public Hub tree API (`/api/models/<repo>/tree/...`, which sends CORS headers):
- each top-level folder is a **base model** (except those in `ignoreDirs`, e.g. `Archive`);
- each `.safetensors` file in it is a **LoRA**. The display name is the file stem minus the model prefix (`MOSS_abigailb` → `abigailb`);
- size, sha256 and last-commit date come from `expand=true`.
Upload a file (or a new model folder) and it shows up on the next page load. Settings live in `src/config.ts`.
### Preview images
Set `previewDataset` in `src/config.ts` to a dataset repo laid out as:
```
<model folder>/<lora file stem>/<anything>.{png,jpg,webp}
MOSS-Image/MOSS_abigailb/01.webp
```
Images are matched to LoRAs automatically. Without them, the page shows a generated monogram placeholder.
## Layout
```
src/
config.ts repo, ignored folders, preview dataset
lib/hub.ts tiny Hub API client (tree listing + URLs, with pagination)
composables/useCatalog.ts builds models + LoRAs from the repo tree
composables/useFilters.ts model / search / sort state, synced to the URL
components/ ModelTabs, LoraToolbar, Segmented, LoraGrid, LoraCard, LoraPreview, LoraDetail, Icon
```
View state lives in the query string (`?model=…&q=…&sort=…&lora=…`), so any view can be shared as a link.