Skip to content

Commit

Permalink
Add gallery component doc (#1093)
Browse files Browse the repository at this point in the history
* add gallery component doc

* wording

* Apply suggestions from code review

Co-authored-by: Victor Muštar <[email protected]>

* dark mode images

* Update model-cards-components.md

---------

Co-authored-by: Victor Muštar <[email protected]>
  • Loading branch information
krampstudio and gary149 authored Nov 13, 2023
1 parent 417d8d6 commit d3c9d81
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/hub/_toctree.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
title: Model Card Guidebook
- local: model-card-landscape-analysis
title: Landscape Analysis
- local: model-cards-components
title: Card Components
- local: models-gated
title: Gated Models
- local: models-uploading
Expand Down
43 changes: 43 additions & 0 deletions docs/hub/model-cards-components.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Model Card components

**Model Card Components** are special elements that you can inject directly into your Model Card markdown to display powerful custom components in your model page. These components are authored by us, feel free to share ideas about new Model Card component in [this discussion](https://huggingface.co/spaces/huggingchat/chat-ui/discussions/312).

## The Gallery component

Add the `<Gallery />` component to your text-to-image model card to showcase your images generation.

For example,
```md

<Gallery />

## Model description

TintinIA is fine-tuned version of Stable-Diffusion-xl trained on 125 comics panels from Tintin album.

```


<div class="flex justify-center">
<img class="block dark:hidden" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/models-gallery.png"/>
<img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/models-gallery-dark.png"/>
</div>

The `<Gallery/>` component will use your Model Card [widget metadata](/docs/hub/models-widgets-examples#text-to-image) to display the images with each associated prompt.

```yaml
widget:
- text: "drawing of tintin in a shop"
output:
url: "images/shop.png"
- text: "drawing of tintin watching rugby"
output:
url: "images/rugby.png"
parameters:
negative_prompt: "blurry"
- text: "tintin working at the office"
output:
url: "images/office.png"
```
> Hint: Support of Card Components through the GUI editor coming soon...

0 comments on commit d3c9d81

Please sign in to comment.