Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
add mini space header
Browse files- package-lock.json +9 -10
- src/app.html +8 -0
- src/lib/components/spaceheader/SpaceMiniHeader.svelte +41 -0
- src/routes/+layout.svelte +2 -0
- src/routes/models/+layout.svelte +0 -2
package-lock.json
CHANGED
@@ -10,6 +10,7 @@
|
|
10 |
"dependencies": {
|
11 |
"@aws-sdk/client-s3": "^3.490.0",
|
12 |
"@huggingface/hub": "^0.12.3",
|
|
|
13 |
"@iconify/svelte": "^3.1.4",
|
14 |
"@prisma/client": "^5.7.1",
|
15 |
"@svelte-put/clickoutside": "^3.0.1",
|
@@ -56,17 +57,10 @@
|
|
56 |
"vite": "^4.4.2"
|
57 |
}
|
58 |
},
|
59 |
-
"
|
60 |
-
"
|
61 |
-
"version": "1.0.0",
|
62 |
-
"extraneous": true,
|
63 |
-
"license": "ISC",
|
64 |
-
"devDependencies": {
|
65 |
-
"tsup": "^8.1.0",
|
66 |
-
"typescript": "^5.4.5"
|
67 |
-
}
|
68 |
},
|
69 |
-
"
|
70 |
"name": "@huggingface/space-header",
|
71 |
"version": "1.0.0",
|
72 |
"extraneous": true,
|
@@ -1287,6 +1281,11 @@
|
|
1287 |
"node": ">=18"
|
1288 |
}
|
1289 |
},
|
|
|
|
|
|
|
|
|
|
|
1290 |
"node_modules/@humanwhocodes/config-array": {
|
1291 |
"version": "0.11.13",
|
1292 |
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz",
|
|
|
10 |
"dependencies": {
|
11 |
"@aws-sdk/client-s3": "^3.490.0",
|
12 |
"@huggingface/hub": "^0.12.3",
|
13 |
+
"@huggingface/space-header": "^1.0.1",
|
14 |
"@iconify/svelte": "^3.1.4",
|
15 |
"@prisma/client": "^5.7.1",
|
16 |
"@svelte-put/clickoutside": "^3.0.1",
|
|
|
57 |
"vite": "^4.4.2"
|
58 |
}
|
59 |
},
|
60 |
+
"../../huggingface.js/packages/space-header": {
|
61 |
+
"extraneous": true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
},
|
63 |
+
"../@huggingface-mini-header": {
|
64 |
"name": "@huggingface/space-header",
|
65 |
"version": "1.0.0",
|
66 |
"extraneous": true,
|
|
|
1281 |
"node": ">=18"
|
1282 |
}
|
1283 |
},
|
1284 |
+
"node_modules/@huggingface/space-header": {
|
1285 |
+
"version": "1.0.1",
|
1286 |
+
"resolved": "https://registry.npmjs.org/@huggingface/space-header/-/space-header-1.0.1.tgz",
|
1287 |
+
"integrity": "sha512-sSHZgWoeCKydlWm/qqIzDwqSHUzr9MqFkS58LZPSnSZNMvhRgU8qQCn9TXHAicFuYyW9W3JkCkc2RpnkfAycyw=="
|
1288 |
+
},
|
1289 |
"node_modules/@humanwhocodes/config-array": {
|
1290 |
"version": "0.11.13",
|
1291 |
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz",
|
src/app.html
CHANGED
@@ -33,6 +33,14 @@
|
|
33 |
content="LoRA Studio is a platform for creating, sharing, and using models"
|
34 |
/>
|
35 |
<meta name="twitter:image" content="https://enzostvs-lora-studio.hf.space/metadata.png" />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
</head>
|
37 |
<body data-sveltekit-preload-data="hover">
|
38 |
<div style="display: contents">%sveltekit.body%</div>
|
|
|
33 |
content="LoRA Studio is a platform for creating, sharing, and using models"
|
34 |
/>
|
35 |
<meta name="twitter:image" content="https://enzostvs-lora-studio.hf.space/metadata.png" />
|
36 |
+
<link
|
37 |
+
ref="stylesheet"
|
38 |
+
href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:ital,wght@0,200;0,300;0,400;0,600;0,700;0,900;1,200;1,300;1,400;1,600;1,700;1,900&display=swap"
|
39 |
+
/>
|
40 |
+
<link
|
41 |
+
rel="stylesheet"
|
42 |
+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600;700&display=swap"
|
43 |
+
/>
|
44 |
</head>
|
45 |
<body data-sveltekit-preload-data="hover">
|
46 |
<div style="display: contents">%sveltekit.body%</div>
|
src/lib/components/spaceheader/SpaceMiniHeader.svelte
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<script lang="ts">
|
2 |
+
import { onMount } from "svelte";
|
3 |
+
|
4 |
+
let space : any = {}
|
5 |
+
let isVisible = false
|
6 |
+
|
7 |
+
onMount(async () => {
|
8 |
+
if (window.location.origin !== "https://huggingface.co") {
|
9 |
+
isVisible = true
|
10 |
+
}
|
11 |
+
const request = await fetch("https://huggingface.co/api/spaces/enzostvs/lora-studio")
|
12 |
+
const response = await request.json()
|
13 |
+
space = response
|
14 |
+
});
|
15 |
+
|
16 |
+
</script>
|
17 |
+
|
18 |
+
{#if space.id && isVisible}
|
19 |
+
<div class="from-gray-50 to-white text-md shadow-alternate fixed right-6 top-5 z-20 flex h-[40px] items-stretch gap-3 overflow-hidden rounded-xl border border-gray-200 bg-gradient-to-t px-4 py-2 text-gray-500 dark:border-gray-800 max-sm:hidden font-other">
|
20 |
+
<div class="flex items-center justify-start gap-2">
|
21 |
+
<img src={`https://huggingface.co/api/users/${space.author}/avatar`} class="w-3.5 h-3.5 rounded-full flex-none" alt={space.author} />
|
22 |
+
<div class="flex items-center justify-center gap-1">
|
23 |
+
<a href="https://huggingface.co/{space.author}" class="text-gray-500 hover:text-blue-600" target="_blank">{space.author}</a>
|
24 |
+
<span class="text-gray-300 text-lg">/</span>
|
25 |
+
<a href="https://huggingface.co/{space.id}" target="_blank" class="font-mono font-semibold text-gray-800 hover:text-blue-600 font-namespace">{space.id?.split('/').pop()}</a>
|
26 |
+
</div>
|
27 |
+
</div>
|
28 |
+
<div class="inline-flex items-center overflow-hidden whitespace-nowrap rounded-md border bg-white text-sm leading-none text-gray-500 flex-none self-center "><button class="relative flex items-center overflow-hidden from-red-50 to-transparent dark:from-red-900 p-1 focus:outline-none" title="Unlike"><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32" fill="currentColor"><path d="M22.45,6a5.47,5.47,0,0,1,3.91,1.64,5.7,5.7,0,0,1,0,8L16,26.13,5.64,15.64a5.7,5.7,0,0,1,0-8,5.48,5.48,0,0,1,7.82,0L16,10.24l2.53-2.58A5.44,5.44,0,0,1,22.45,6m0-2a7.47,7.47,0,0,0-5.34,2.24L16,7.36,14.89,6.24a7.49,7.49,0,0,0-10.68,0,7.72,7.72,0,0,0,0,10.82L16,29,27.79,17.06a7.72,7.72,0,0,0,0-10.82A7.49,7.49,0,0,0,22.45,4Z"></path></svg> <svg class="absolute text-red-500 origin-center transform transition-transform ease-in
|
29 |
+
|
30 |
+
" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32" fill="currentColor"><path d="M22.5,4c-2,0-3.9,0.8-5.3,2.2L16,7.4l-1.1-1.1C12,3.3,7.2,3.3,4.3,6.2c0,0-0.1,0.1-0.1,0.1c-3,3-3,7.8,0,10.8L16,29l11.8-11.9c3-3,3-7.8,0-10.8C26.4,4.8,24.5,4,22.5,4z"></path></svg> <span class="ml-4 pl-0.5 hidden">like</span></button> <button class="flex items-center border-l px-1.5 py-1 text-gray-400 focus:bg-gray-100 focus:outline-none" title="See users who liked this repository">{space.likes}</button></div>
|
31 |
+
</div>
|
32 |
+
{/if}
|
33 |
+
|
34 |
+
<style>
|
35 |
+
.font-namespace {
|
36 |
+
font-family: "IBM Plex Mono", sans-serif;
|
37 |
+
}
|
38 |
+
.font-other {
|
39 |
+
font-family: "Source Sans Pro", sans-serif;
|
40 |
+
}
|
41 |
+
</style>
|
src/routes/+layout.svelte
CHANGED
@@ -8,6 +8,7 @@
|
|
8 |
import { openWindowLogin, userStore } from "$lib/stores/use-user";
|
9 |
import Dialog from "$lib/components/dialog/Dialog.svelte";
|
10 |
import { loginModalStore } from "$lib/stores/use-login-modal";
|
|
|
11 |
|
12 |
export let data;
|
13 |
userStore.set(data?.user?.user);
|
@@ -20,6 +21,7 @@
|
|
20 |
</script>
|
21 |
|
22 |
<div class="flex items-start">
|
|
|
23 |
<Sidebar />
|
24 |
<main id="app" class="flex-1 h-screen overflow-y-auto">
|
25 |
<slot />
|
|
|
8 |
import { openWindowLogin, userStore } from "$lib/stores/use-user";
|
9 |
import Dialog from "$lib/components/dialog/Dialog.svelte";
|
10 |
import { loginModalStore } from "$lib/stores/use-login-modal";
|
11 |
+
import SpaceMiniHeader from "$lib/components/spaceheader/SpaceMiniHeader.svelte";
|
12 |
|
13 |
export let data;
|
14 |
userStore.set(data?.user?.user);
|
|
|
21 |
</script>
|
22 |
|
23 |
<div class="flex items-start">
|
24 |
+
<SpaceMiniHeader />
|
25 |
<Sidebar />
|
26 |
<main id="app" class="flex-1 h-screen overflow-y-auto">
|
27 |
<slot />
|
src/routes/models/+layout.svelte
CHANGED
@@ -3,7 +3,6 @@
|
|
3 |
import InfiniteScroll from "svelte-infinite-scroll";
|
4 |
import { page } from "$app/stores";
|
5 |
import { onMount } from "svelte";
|
6 |
-
// import { init } from "@huggingface/space-header";
|
7 |
|
8 |
import { goto } from "$app/navigation";
|
9 |
import Button from "$lib/components/Button.svelte";
|
@@ -33,7 +32,6 @@
|
|
33 |
|
34 |
onMount(() => {
|
35 |
refetch(false);
|
36 |
-
// init("enzostvs/lora-studio");
|
37 |
});
|
38 |
|
39 |
$: elementScroll = browser ? document?.getElementById('app') : undefined;
|
|
|
3 |
import InfiniteScroll from "svelte-infinite-scroll";
|
4 |
import { page } from "$app/stores";
|
5 |
import { onMount } from "svelte";
|
|
|
6 |
|
7 |
import { goto } from "$app/navigation";
|
8 |
import Button from "$lib/components/Button.svelte";
|
|
|
32 |
|
33 |
onMount(() => {
|
34 |
refetch(false);
|
|
|
35 |
});
|
36 |
|
37 |
$: elementScroll = browser ? document?.getElementById('app') : undefined;
|