Spaces:
Runtime error
Runtime error
wip
Browse filesFiles changed (2)
7 unmodified lines89101112131418 unmodified lines3334353637383994 unmodified lines1341351361371381391401411421431441451461478 unmodified lines156157158159160161162163164165166167168169100 unmodified lines2702712722732742752767 unmodified linesimport GenerationConfig from './InferencePlaygroundGenerationConfig.svelte';import HFTokenModal from './InferencePlaygroundHFTokenModal.svelte';import ModelSelector from './InferencePlaygroundModelSelector.svelte';import ModelPickerModal from './InferencePlaygroundModelPickerModal.svelte';import Conversation from './InferencePlaygroundConversation.svelte';import { onDestroy } from 'svelte';import { type ChatCompletionInputMessage } from '@huggingface/tasks';18 unmodified lineslet hfToken: string | undefined = import.meta.env.VITE_HF_TOKEN;let viewCode = false;let showTokenModal = false;let showModelPickerModal = false;let loading = false;let latency = 0;let abortController: AbortController | undefined = undefined;94 unmodified linessubmit();}}function changeModel(modelId: string) {const model = models.find((m) => m.id === modelId);if (!model) {return;}conversation.model = model;}</script>{#if showTokenModal}8 unmodified lines/>{/if}{#if showModelPickerModal}<ModelPickerModal{models}on:modelSelected={(e) => changeModel(e.detail)}on:close={(e) => (showModelPickerModal = false)}/>{/if}<!-- svelte-ignore a11y-no-static-element-interactions --><divclass="w-dvh grid divide-gray-200 overflow-hidden bg-gray-100/50 max-md:divide-y md:h-dvh md:grid-cols-[clamp(220px,20%,350px),minmax(0,1fr),clamp(270px,25%,300px)] dark:divide-gray-800 dark:bg-gray-900 dark:text-gray-300 dark:[color-scheme:dark]"100 unmodified lines<divclass="flex flex-1 flex-col gap-6 overflow-y-hidden rounded-xl border border-gray-200/80 bg-gradient-to-b from-white via-white p-3 shadow-sm dark:border-white/5 dark:from-gray-800/40 dark:via-gray-800/40"><ModelSelector {models} bind:conversation on:click={() => (showModelPickerModal = open)} /><GenerationConfig bind:conversation /><div class="mt-auto">7 unmodified lines891011121318 unmodified lines32333435363794 unmodified lines1321331341351361378 unmodified lines146147148149150151100 unmodified lines2522532542552562572587 unmodified linesimport GenerationConfig from './InferencePlaygroundGenerationConfig.svelte';import HFTokenModal from './InferencePlaygroundHFTokenModal.svelte';import ModelSelector from './InferencePlaygroundModelSelector.svelte';import Conversation from './InferencePlaygroundConversation.svelte';import { onDestroy } from 'svelte';import { type ChatCompletionInputMessage } from '@huggingface/tasks';18 unmodified lineslet hfToken: string | undefined = import.meta.env.VITE_HF_TOKEN;let viewCode = false;let showTokenModal = false;let loading = false;let latency = 0;let abortController: AbortController | undefined = undefined;94 unmodified linessubmit();}}</script>{#if showTokenModal}8 unmodified lines/>{/if}<!-- svelte-ignore a11y-no-static-element-interactions --><divclass="w-dvh grid divide-gray-200 overflow-hidden bg-gray-100/50 max-md:divide-y md:h-dvh md:grid-cols-[clamp(220px,20%,350px),minmax(0,1fr),clamp(270px,25%,300px)] dark:divide-gray-800 dark:bg-gray-900 dark:text-gray-300 dark:[color-scheme:dark]"100 unmodified lines<divclass="flex flex-1 flex-col gap-6 overflow-y-hidden rounded-xl border border-gray-200/80 bg-gradient-to-b from-white via-white p-3 shadow-sm dark:border-white/5 dark:from-gray-800/40 dark:via-gray-800/40"><ModelSelector {models} bind:conversation /><GenerationConfig bind:conversation /><div class="mt-auto">
123456789106 unmodified lines1718192021222324253 unmodified lines29303132333435<script lang="ts">import type { Conversation, ModelEntryWithTokenizer } from '$lib/types';import IconCaret from '../Icons/IconCaret.svelte';export let models: ModelEntryWithTokenizer[] = [];export let conversation: Conversation;async function getAvatarUrl(orgName: string) {const url = `https://huggingface.co/api/organizations/${orgName}/avatar`;const res = await fetch(url);6 unmodified linesreturn avatarUrl;}$: [nameSpace, modelName] = conversation.model.id.split('/');</script><div class="flex flex-col gap-2"><labelfor="countries"3 unmodified lines<buttonclass="flex items-center justify-between gap-6 overflow-hidden whitespace-nowrap rounded-lg border bg-gray-100/80 px-3 py-1.5 leading-tight shadow dark:bg-gray-700"on:click><div class="flex flex-col items-start"><div class="flex items-center gap-1 text-sm text-gray-500 dark:text-gray-300">123456789101112136 unmodified lines202122232425262728293031323334353637383940414243443 unmodified lines48495051525354<script lang="ts">import type { Conversation, ModelEntryWithTokenizer } from '$lib/types';import IconCaret from '../Icons/IconCaret.svelte';import ModelPickerModal from './InferencePlaygroundModelPickerModal.svelte';export let models: ModelEntryWithTokenizer[] = [];export let conversation: Conversation;let showModelPickerModal = false;async function getAvatarUrl(orgName: string) {const url = `https://huggingface.co/api/organizations/${orgName}/avatar`;const res = await fetch(url);6 unmodified linesreturn avatarUrl;}function changeModel(modelId: string) {const model = models.find((m) => m.id === modelId);if (!model) {return;}conversation.model = model;}$: [nameSpace, modelName] = conversation.model.id.split('/');</script>{#if showModelPickerModal}<ModelPickerModal{models}on:modelSelected={(e) => changeModel(e.detail)}on:close={(e) => (showModelPickerModal = false)}/>{/if}<div class="flex flex-col gap-2"><labelfor="countries"3 unmodified lines<buttonclass="flex items-center justify-between gap-6 overflow-hidden whitespace-nowrap rounded-lg border bg-gray-100/80 px-3 py-1.5 leading-tight shadow dark:bg-gray-700"on:click={() => (showModelPickerModal = true)}><div class="flex flex-col items-start"><div class="flex items-center gap-1 text-sm text-gray-500 dark:text-gray-300">
src/lib/components/InferencePlayground/InferencePlayground.svelte+1-19
src/lib/components/InferencePlayground/InferencePlaygroundModelSelector.svelte+20-1