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

29 lines
752 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";
import { Block } from "@gradio/atoms";
import StatusTracker from "../StatusTracker/StatusTracker.svelte";
import type { LoadingStatus } from "../StatusTracker/types";
2022-03-08 21:35:42 +08:00
export let value: {
label: string;
confidences?: Array<{ label: string; confidence: number }>;
};
2022-03-29 21:10:35 +08:00
export let style: string = "";
export let loading_status: LoadingStatus;
export let show_label: boolean;
2022-03-17 00:34:30 +08:00
const dispatch = createEventDispatcher<{ change: undefined }>();
$: value, dispatch("change");
2022-03-08 21:35:42 +08:00
</script>
<Block>
<StatusTracker {...loading_status} />
{#if value !== undefined && value !== null}
<Label {style} {value} {show_label} />
{/if}
</Block>