mirror of
https://github.com/gradio-app/gradio.git
synced 2024-12-21 02:19:59 +08:00
2afca65419
* File size limits
* Implementation
* add changeset
* Fix tests
* python client support
* lint
* fix test
* lint
* add changeset
* Set at the blocks level
* add changeset
* type check
* format
* lint
* lint
* Delete files as soon as they're encountered
* fix tests
* type hint 🙄
* Fix tests
* Fix below limit test
* add changeset
* Fix tests
* Add client file
* revert loop code
* Add to guides
* Pass in via gradio component
* add changeset
* Update loading status
* Make errors closeable
* add changeset
* Add code
* Lint
* Changelog highlight
* Fix i18n in storybook
* Address comments
---------
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
101 lines
2.8 KiB
Svelte
101 lines
2.8 KiB
Svelte
<script>
|
|
import { Meta, Template, Story } from "@storybook/addon-svelte-csf";
|
|
import HighlightedText from "./Index.svelte";
|
|
import { Gradio } from "@gradio/utils";
|
|
</script>
|
|
|
|
<Meta title="Components/HighlightedText" component={HighlightedText} />
|
|
|
|
<Template let:args>
|
|
<HighlightedText
|
|
value={[
|
|
{ token: "zebras", class_or_confidence: "+" },
|
|
{ token: "dogs", class_or_confidence: "-" },
|
|
{ token: "elephants", class_or_confidence: "+" }
|
|
]}
|
|
{...args}
|
|
/>
|
|
</Template>
|
|
|
|
<Story name="Highlighted Text Default" />
|
|
<Story name="Highlighted Text with legend" args={{ show_legend: true }} />
|
|
<Story name="Highlighted Text with label" args={{ label: "animals" }} />
|
|
<Story
|
|
name="Highlighted Text with new lines"
|
|
args={{
|
|
value: [
|
|
{ token: "zebras", class_or_confidence: "+" },
|
|
{ token: "\n" },
|
|
{ token: "dogs", class_or_confidence: "-" },
|
|
{ token: "\n" },
|
|
{ token: "elephants", class_or_confidence: "+" }
|
|
]
|
|
}}
|
|
/>
|
|
<Story
|
|
name="Highlighted Text with color map"
|
|
args={{ color_map: { "+": "green", "-": "red" } }}
|
|
/>
|
|
|
|
<Story
|
|
name="Highlighted Text with combine adjacent"
|
|
args={{
|
|
value: [
|
|
{ token: "The", class_or_confidence: null },
|
|
{ token: "quick", class_or_confidence: "adjective" },
|
|
{ token: " sneaky", class_or_confidence: "adjective" },
|
|
{ token: "fox", class_or_confidence: "subject" },
|
|
{ token: " jumped ", class_or_confidence: "past tense verb" },
|
|
{ token: "over the", class_or_confidence: null },
|
|
{ token: "lazy dog", class_or_confidence: "object" }
|
|
],
|
|
combine_adjacent: true
|
|
}}
|
|
/>
|
|
|
|
<Story
|
|
name="Highlighted Text without combine adjacent"
|
|
args={{
|
|
value: [
|
|
{ token: "The", class_or_confidence: null },
|
|
{ token: "quick", class_or_confidence: "adjective" },
|
|
{ token: " sneaky", class_or_confidence: "adjective" },
|
|
{ token: "fox", class_or_confidence: "subject" },
|
|
{ token: " jumped ", class_or_confidence: "past tense verb" },
|
|
{ token: "over the", class_or_confidence: null },
|
|
{ token: "lazy dog", class_or_confidence: "object" }
|
|
]
|
|
}}
|
|
/>
|
|
|
|
<Story
|
|
name="Highlighted Text with combine adjacent and new lines"
|
|
args={{
|
|
value: [
|
|
{ token: "The", class_or_confidence: null },
|
|
{ token: "quick", class_or_confidence: "adjective" },
|
|
{ token: " sneaky", class_or_confidence: "adjective" },
|
|
{ token: "fox", class_or_confidence: "subject" },
|
|
{ token: "\n", class_or_confidence: null },
|
|
{ token: " jumped ", class_or_confidence: "past tense verb" },
|
|
{ token: "\n", class_or_confidence: null },
|
|
{ token: "over the", class_or_confidence: null },
|
|
{ token: "lazy dog", class_or_confidence: "object" }
|
|
],
|
|
|
|
combine_adjacent: true
|
|
}}
|
|
/>
|
|
|
|
<Story
|
|
name="Highlighted Text in scores mode"
|
|
args={{
|
|
value: [
|
|
{ token: "the", class_or_confidence: -1 },
|
|
{ token: "quick", class_or_confidence: 1 },
|
|
{ token: "fox", class_or_confidence: 0.3 }
|
|
],
|
|
show_legend: true
|
|
}}
|
|
/>
|