gradio/ui/packages/app/src/components/Label/Label.svelte

27 lines
626 B
Svelte
Raw Normal View History

2022-03-08 21:35:42 +08:00
<script lang="ts">
2022-03-17 00:34:30 +08:00
import { createEventDispatcher } from "svelte";
2022-03-08 21:35:42 +08:00
import { Label } from "@gradio/label";
export let value: {
label: string;
confidences?: Array<{ label: string; confidence: number }>;
};
2022-03-29 21:10:35 +08:00
export let default_value: {
label: string;
confidences?: Array<{ label: string; confidence: number }>;
};
2022-03-08 21:35:42 +08:00
export let theme: string;
export let style: string | null;
2022-03-17 00:34:30 +08:00
const dispatch = createEventDispatcher<{ change: undefined }>();
2022-03-29 21:10:35 +08:00
if (default_value) value = default_value;
2022-03-17 00:34:30 +08:00
$: value, dispatch("change");
2022-03-08 21:35:42 +08:00
</script>
{#if value !== undefined && value !== null}
2022-03-25 12:00:30 +08:00
<Label {theme} {style} {value} />
2022-03-25 14:03:47 +08:00
{/if}