Spaces:
Running
Running
dylanebert
commited on
Commit
·
48bc2fc
1
Parent(s):
d4f23a0
add model details; fix sizing
Browse files- src/routes/ModelDetails.svelte +67 -15
- src/routes/Viewer.svelte +1 -1
- static/global.css +15 -0
src/routes/ModelDetails.svelte
CHANGED
|
@@ -8,11 +8,18 @@
|
|
| 8 |
thumbnail: string;
|
| 9 |
}
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
export let modelName: string;
|
| 12 |
export let onBack: () => void;
|
| 13 |
export let onSceneClick: (scene: Scene) => void;
|
| 14 |
|
| 15 |
let scenes: Scene[] = [];
|
|
|
|
| 16 |
|
| 17 |
async function fetchScenes() {
|
| 18 |
scenes = [];
|
|
@@ -37,6 +44,10 @@
|
|
| 37 |
return acc;
|
| 38 |
}, []);
|
| 39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
scenes = [...scenes];
|
| 41 |
}
|
| 42 |
|
|
@@ -53,18 +64,59 @@
|
|
| 53 |
</button>
|
| 54 |
<div class="desktop-spacer" />
|
| 55 |
</div>
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
<
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
{
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
thumbnail: string;
|
| 9 |
}
|
| 10 |
|
| 11 |
+
interface Config {
|
| 12 |
+
Model: string;
|
| 13 |
+
Space: string;
|
| 14 |
+
Paper: string;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
export let modelName: string;
|
| 18 |
export let onBack: () => void;
|
| 19 |
export let onSceneClick: (scene: Scene) => void;
|
| 20 |
|
| 21 |
let scenes: Scene[] = [];
|
| 22 |
+
let config: Config;
|
| 23 |
|
| 24 |
async function fetchScenes() {
|
| 25 |
scenes = [];
|
|
|
|
| 44 |
return acc;
|
| 45 |
}, []);
|
| 46 |
|
| 47 |
+
const configUrl = `https://huggingface.co/datasets/dylanebert/3d-arena/resolve/main/outputs/${modelName}/config.json`;
|
| 48 |
+
const configResponse = await fetch(configUrl);
|
| 49 |
+
config = (await configResponse.json()) as Config;
|
| 50 |
+
|
| 51 |
scenes = [...scenes];
|
| 52 |
}
|
| 53 |
|
|
|
|
| 64 |
</button>
|
| 65 |
<div class="desktop-spacer" />
|
| 66 |
</div>
|
| 67 |
+
|
| 68 |
+
<div class="model-details">
|
| 69 |
+
{#if config && (config.Model || config.Space || config.Paper)}
|
| 70 |
+
<table class="config-table">
|
| 71 |
+
{#if config.Model}
|
| 72 |
+
<tr>
|
| 73 |
+
<td>Model:</td>
|
| 74 |
+
<td
|
| 75 |
+
><a class="muted" href={config.Model} target="_blank"
|
| 76 |
+
>{config.Model.replace("https://huggingface.co/", "")}</a
|
| 77 |
+
></td
|
| 78 |
+
>
|
| 79 |
+
</tr>
|
| 80 |
+
{/if}
|
| 81 |
+
{#if config.Space}
|
| 82 |
+
<tr>
|
| 83 |
+
<td>Space:</td>
|
| 84 |
+
<td
|
| 85 |
+
><a class="muted" href={config.Space} target="_blank"
|
| 86 |
+
>{config.Space.replace("https://huggingface.co/spaces/", "")}</a
|
| 87 |
+
></td
|
| 88 |
+
>
|
| 89 |
+
</tr>
|
| 90 |
+
{/if}
|
| 91 |
+
{#if config.Paper}
|
| 92 |
+
<tr>
|
| 93 |
+
<td>Paper:</td>
|
| 94 |
+
<td
|
| 95 |
+
><a class="muted" href={config.Paper} target="_blank"
|
| 96 |
+
>{config.Paper.replace("https://huggingface.co/papers/", "").replace(
|
| 97 |
+
"https://arxiv.org/abs/",
|
| 98 |
+
""
|
| 99 |
+
)}</a
|
| 100 |
+
></td
|
| 101 |
+
>
|
| 102 |
+
</tr>
|
| 103 |
+
{/if}
|
| 104 |
+
</table>
|
| 105 |
+
{/if}
|
| 106 |
+
|
| 107 |
+
{#if scenes.length > 0}
|
| 108 |
+
<div class="grid">
|
| 109 |
+
{#each scenes as scene}
|
| 110 |
+
<button class="grid-item" on:click={() => onSceneClick(scene)}>
|
| 111 |
+
<img src={scene.thumbnail} alt={scene.name} class="thumbnail" />
|
| 112 |
+
<div class="title">{scene.name}</div>
|
| 113 |
+
</button>
|
| 114 |
+
{/each}
|
| 115 |
+
</div>
|
| 116 |
+
{:else}
|
| 117 |
+
<div class="loading-container">
|
| 118 |
+
<ProgressBarRound class="loading-icon" />
|
| 119 |
+
<div class="loading-text">Loading...</div>
|
| 120 |
+
</div>
|
| 121 |
+
{/if}
|
| 122 |
+
</div>
|
src/routes/Viewer.svelte
CHANGED
|
@@ -89,5 +89,5 @@
|
|
| 89 |
<div bind:this={loadingBarFill} class="loading-bar-fill" />
|
| 90 |
</div>
|
| 91 |
</div>
|
| 92 |
-
<canvas bind:this={canvas} width={800} height={600} />
|
| 93 |
</div>
|
|
|
|
| 89 |
<div bind:this={loadingBarFill} class="loading-bar-fill" />
|
| 90 |
</div>
|
| 91 |
</div>
|
| 92 |
+
<canvas class="viewer-canvas" bind:this={canvas} width={800} height={600} />
|
| 93 |
</div>
|
static/global.css
CHANGED
|
@@ -66,6 +66,17 @@ body {
|
|
| 66 |
}
|
| 67 |
}
|
| 68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
.container {
|
| 70 |
padding: 10px 15px 80px 15px;
|
| 71 |
margin-left: auto;
|
|
@@ -343,6 +354,10 @@ body {
|
|
| 343 |
aspect-ratio: 1 / 1;
|
| 344 |
}
|
| 345 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 346 |
.vote-button {
|
| 347 |
background-color: #333;
|
| 348 |
color: #fff;
|
|
|
|
| 66 |
}
|
| 67 |
}
|
| 68 |
|
| 69 |
+
.config-table {
|
| 70 |
+
margin: 1rem auto;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
@media (min-width: 768px) {
|
| 74 |
+
.config-table tr {
|
| 75 |
+
display: inline-block;
|
| 76 |
+
margin-right: 1rem;
|
| 77 |
+
}
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
.container {
|
| 81 |
padding: 10px 15px 80px 15px;
|
| 82 |
margin-left: auto;
|
|
|
|
| 354 |
aspect-ratio: 1 / 1;
|
| 355 |
}
|
| 356 |
|
| 357 |
+
.viewer-canvas {
|
| 358 |
+
aspect-ratio: 16 / 9;
|
| 359 |
+
}
|
| 360 |
+
|
| 361 |
.vote-button {
|
| 362 |
background-color: #333;
|
| 363 |
color: #fff;
|