Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
show_download_button
to gr.Image() (#4959)
* add show_download_button param * add static image story * chlog * fix test * typo * add default value Co-authored-by: Abubakar Abid <abubakar@huggingface.co> * fix test * fix another test --------- Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
- Loading branch information
1 parent
fdc9ca2
commit a0efc11
Showing
7 changed files
with
77 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<script> | ||
import { Meta, Template, Story } from "@storybook/addon-svelte-csf"; | ||
import StaticImage from "./StaticImage.svelte"; | ||
</script> | ||
|
||
<Meta | ||
title="Components/Image" | ||
component={Image} | ||
argTypes={{ | ||
value: { | ||
control: "text", | ||
description: "The image URL or file to display", | ||
name: "value", | ||
value: "https://i.ibb.co/6BgKdSj/groot.jpg" | ||
}, | ||
show_download_button: { | ||
options: [true, false], | ||
description: "If false, the download button will not be visible", | ||
control: { type: "boolean" }, | ||
defaultValue: true | ||
}, | ||
}} | ||
/> | ||
|
||
<Template let:args> | ||
<div class="image-container" style="width: 300px; position: relative;border-radius: var(--radius-lg);overflow: hidden;"> | ||
<StaticImage {...args} /> | ||
</div> | ||
</Template> | ||
|
||
<Story | ||
name="Static Image with label and download button" | ||
args={{ | ||
value: "https://i.ibb.co/6BgKdSj/groot.jpg", | ||
show_label: true, | ||
show_download_button: true | ||
}} | ||
/> | ||
|
||
<Story | ||
name="Static Image with no label or download button" | ||
args={{ | ||
value: "https://i.ibb.co/6BgKdSj/groot.jpg", | ||
show_label: false, | ||
show_download_button: false | ||
}} | ||
/> | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a0efc11
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
gradio – ./
gradio-git-main-hugging-face.vercel.app
www.gradio.app
gradio-two.vercel.app
gradio-hugging-face.vercel.app
gradio.app