Download src/lib/components/common/Image.svelte from ancoai/open-ui: direct link, hf CLI and curl.
- Browser
- Download file 653 Bytes
-
https://huggingface.co/spaces/ancoai/open-ui/resolve/main/src/lib/components/common/Image.svelte
- Command line
-
hf download hf://spaces/ancoai/open-ui/src/lib/components/common/Image.svelte
-
curl -L -o Image.svelte https://huggingface.co/spaces/ancoai/open-ui/resolve/main/src/lib/components/common/Image.svelte
653 Bytes
| <script lang="ts"> | |
| import { WEBUI_BASE_URL } from '$lib/constants'; | |
| import ImagePreview from './ImagePreview.svelte'; | |
| export let src = ''; | |
| export let alt = ''; | |
| export let className = ' w-full outline-none focus:outline-none'; | |
| export let imageClassName = 'rounded-lg'; | |
| let _src = ''; | |
| $: _src = src.startsWith('/') ? `${WEBUI_BASE_URL}${src}` : src; | |
| let showImagePreview = false; | |
| </script> | |
| <button | |
| class={className} | |
| on:click={() => { | |
| showImagePreview = true; | |
| }} | |
| type="button" | |
| > | |
| <img src={_src} {alt} class={imageClassName} draggable="false" data-cy="image" /> | |
| </button> | |
| <ImagePreview bind:show={showImagePreview} src={_src} {alt} /> | |