diff --git a/.changeset/swift-peas-allow.md b/.changeset/swift-peas-allow.md new file mode 100644 index 0000000000000..4f2c19c1abf94 --- /dev/null +++ b/.changeset/swift-peas-allow.md @@ -0,0 +1,5 @@ +--- +"website": minor +--- + +feat:Bring back embedded demos on component docs diff --git a/js/_website/src/lib/assets/style.css b/js/_website/src/lib/assets/style.css index af22db89d2e0c..36d50a3acaf68 100644 --- a/js/_website/src/lib/assets/style.css +++ b/js/_website/src/lib/assets/style.css @@ -295,3 +295,10 @@ strong { .obj ul { padding-inline-start: 40px; } + +.embedded-component .gradio-container { + padding: var(--size-4) 0 0 0 !important; +} +.embedded-component .gradio-container footer { + display: none !important; +} diff --git a/js/_website/src/lib/templates/gradio/03_components/annotatedimage.svx b/js/_website/src/lib/templates/gradio/03_components/annotatedimage.svx index 7c6457c521005..64b01d81133d1 100644 --- a/js/_website/src/lib/templates/gradio/03_components/annotatedimage.svx +++ b/js/_website/src/lib/templates/gradio/03_components/annotatedimage.svx @@ -20,6 +20,31 @@ gradio.AnnotatedImage(···) ``` + +
+ + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/audio.svx b/js/_website/src/lib/templates/gradio/03_components/audio.svx index 59c9b986cc9c3..195f9a8db4872 100644 --- a/js/_website/src/lib/templates/gradio/03_components/audio.svx +++ b/js/_website/src/lib/templates/gradio/03_components/audio.svx @@ -21,6 +21,16 @@ gradio.Audio(···) ``` + + + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/barplot.svx b/js/_website/src/lib/templates/gradio/03_components/barplot.svx index 719a3c8db16e6..00707ddd649c7 100644 --- a/js/_website/src/lib/templates/gradio/03_components/barplot.svx +++ b/js/_website/src/lib/templates/gradio/03_components/barplot.svx @@ -20,6 +20,43 @@ gradio.BarPlot(···) ``` + + + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/button.svx b/js/_website/src/lib/templates/gradio/03_components/button.svx index 51932cf07ee2b..6d470e1848340 100644 --- a/js/_website/src/lib/templates/gradio/03_components/button.svx +++ b/js/_website/src/lib/templates/gradio/03_components/button.svx @@ -20,6 +20,16 @@ gradio.Button(···) ``` + + + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/chatbot.svx b/js/_website/src/lib/templates/gradio/03_components/chatbot.svx index 443f7600a595f..969a9a189edde 100644 --- a/js/_website/src/lib/templates/gradio/03_components/chatbot.svx +++ b/js/_website/src/lib/templates/gradio/03_components/chatbot.svx @@ -20,6 +20,16 @@ gradio.Chatbot(···) ``` + + + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/checkbox.svx b/js/_website/src/lib/templates/gradio/03_components/checkbox.svx index de45e1e5b5b61..00263a13fc331 100644 --- a/js/_website/src/lib/templates/gradio/03_components/checkbox.svx +++ b/js/_website/src/lib/templates/gradio/03_components/checkbox.svx @@ -20,6 +20,16 @@ gradio.Checkbox(···) ``` + + + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/checkboxgroup.svx b/js/_website/src/lib/templates/gradio/03_components/checkboxgroup.svx index 83f9592bf0992..1f0dc7f69eb17 100644 --- a/js/_website/src/lib/templates/gradio/03_components/checkboxgroup.svx +++ b/js/_website/src/lib/templates/gradio/03_components/checkboxgroup.svx @@ -20,6 +20,16 @@ gradio.CheckboxGroup(···) ``` + + + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/clearbutton.svx b/js/_website/src/lib/templates/gradio/03_components/clearbutton.svx index 1f42c13d3698e..7381d61e6fa98 100644 --- a/js/_website/src/lib/templates/gradio/03_components/clearbutton.svx +++ b/js/_website/src/lib/templates/gradio/03_components/clearbutton.svx @@ -20,6 +20,17 @@ gradio.ClearButton(···) ``` + + + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/code.svx b/js/_website/src/lib/templates/gradio/03_components/code.svx index 97a43ef242218..0c6f399f6798c 100644 --- a/js/_website/src/lib/templates/gradio/03_components/code.svx +++ b/js/_website/src/lib/templates/gradio/03_components/code.svx @@ -20,6 +20,22 @@ gradio.Code(···) ``` + + + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/colorpicker.svx b/js/_website/src/lib/templates/gradio/03_components/colorpicker.svx index 9df8af7fbeaec..7c9d3e5ef1e1f 100644 --- a/js/_website/src/lib/templates/gradio/03_components/colorpicker.svx +++ b/js/_website/src/lib/templates/gradio/03_components/colorpicker.svx @@ -20,6 +20,21 @@ gradio.ColorPicker(···) ``` + + + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/dataframe.svx b/js/_website/src/lib/templates/gradio/03_components/dataframe.svx index 95fbb70207159..e0e33670e1947 100644 --- a/js/_website/src/lib/templates/gradio/03_components/dataframe.svx +++ b/js/_website/src/lib/templates/gradio/03_components/dataframe.svx @@ -20,6 +20,21 @@ gradio.Dataframe(···) ``` + + + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/dataset.svx b/js/_website/src/lib/templates/gradio/03_components/dataset.svx index e9851674ea9bf..c2f9f2ce9adee 100644 --- a/js/_website/src/lib/templates/gradio/03_components/dataset.svx +++ b/js/_website/src/lib/templates/gradio/03_components/dataset.svx @@ -20,6 +20,27 @@ gradio.Dataset(···) ``` + + + + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/dropdown.svx b/js/_website/src/lib/templates/gradio/03_components/dropdown.svx index 42e6f5ca74e72..301a50342294c 100644 --- a/js/_website/src/lib/templates/gradio/03_components/dropdown.svx +++ b/js/_website/src/lib/templates/gradio/03_components/dropdown.svx @@ -20,6 +20,16 @@ gradio.Dropdown(···) ``` + + + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/duplicatebutton.svx b/js/_website/src/lib/templates/gradio/03_components/duplicatebutton.svx index 9c7fc1e74b7b6..e6671f05dbb89 100644 --- a/js/_website/src/lib/templates/gradio/03_components/duplicatebutton.svx +++ b/js/_website/src/lib/templates/gradio/03_components/duplicatebutton.svx @@ -20,6 +20,16 @@ gradio.DuplicateButton(···) ``` + + + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/file.svx b/js/_website/src/lib/templates/gradio/03_components/file.svx index 274cc2aadb0ba..772fa47097786 100644 --- a/js/_website/src/lib/templates/gradio/03_components/file.svx +++ b/js/_website/src/lib/templates/gradio/03_components/file.svx @@ -20,6 +20,16 @@ gradio.File(···) ``` + + + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/gallery.svx b/js/_website/src/lib/templates/gradio/03_components/gallery.svx index b46a34cdbf533..475f5866b7f31 100644 --- a/js/_website/src/lib/templates/gradio/03_components/gallery.svx +++ b/js/_website/src/lib/templates/gradio/03_components/gallery.svx @@ -20,6 +20,23 @@ gradio.Gallery(···) ``` + + + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/highlightedtext.svx b/js/_website/src/lib/templates/gradio/03_components/highlightedtext.svx index c169724a2d487..ec134dbb16e69 100644 --- a/js/_website/src/lib/templates/gradio/03_components/highlightedtext.svx +++ b/js/_website/src/lib/templates/gradio/03_components/highlightedtext.svx @@ -20,6 +20,30 @@ gradio.HighlightedText(···) ``` + + + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/html.svx b/js/_website/src/lib/templates/gradio/03_components/html.svx index d0dabb9465448..e61aead6c42d2 100644 --- a/js/_website/src/lib/templates/gradio/03_components/html.svx +++ b/js/_website/src/lib/templates/gradio/03_components/html.svx @@ -10,6 +10,8 @@ import { style_formatted_text } from "$lib/text"; let obj = get_object("html"); + + let embedded_demo = "This example was written in HTML
" @@ -20,6 +22,17 @@ gradio.HTML(···) ``` + + + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/image.svx b/js/_website/src/lib/templates/gradio/03_components/image.svx index cdba4719277ce..d432677684c12 100644 --- a/js/_website/src/lib/templates/gradio/03_components/image.svx +++ b/js/_website/src/lib/templates/gradio/03_components/image.svx @@ -20,6 +20,16 @@ gradio.Image(···) ``` + + + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/imageeditor.svx b/js/_website/src/lib/templates/gradio/03_components/imageeditor.svx index 39bc5501def3d..28587103018a2 100644 --- a/js/_website/src/lib/templates/gradio/03_components/imageeditor.svx +++ b/js/_website/src/lib/templates/gradio/03_components/imageeditor.svx @@ -22,6 +22,17 @@ gradio.ImageEditor(···) ``` + + + + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/json.svx b/js/_website/src/lib/templates/gradio/03_components/json.svx index 5f8b67acbba07..068748e892084 100644 --- a/js/_website/src/lib/templates/gradio/03_components/json.svx +++ b/js/_website/src/lib/templates/gradio/03_components/json.svx @@ -10,6 +10,17 @@ import { style_formatted_text } from "$lib/text"; let obj = get_object("json"); + let embedded_demo_obj = `{ + "Key 1": "Value 1", + "Key 2": {"Key 3": "Value 2", "Key 4": "Value 3"}, + "Key 5": ["Item 1", "Item 2", "Item 3"], + "Key 6": 123, + "Key 7": 123.456, + "Key 8": True, + "Key 9": False, + "Key 10": None, + "Key 11": np.array([1, 2, 3]), + }` @@ -20,6 +31,20 @@ gradio.JSON(···) ``` + + + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/label.svx b/js/_website/src/lib/templates/gradio/03_components/label.svx index ce6e5af4cdaf3..fc372394b9d16 100644 --- a/js/_website/src/lib/templates/gradio/03_components/label.svx +++ b/js/_website/src/lib/templates/gradio/03_components/label.svx @@ -10,6 +10,7 @@ import { style_formatted_text } from "$lib/text"; let obj = get_object("label"); + let embedded_demo_value = `{"First Label": 0.7, "Second Label": 0.2, "Third Label": 0.1}` @@ -20,6 +21,16 @@ gradio.Label(···) ``` + + + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/lineplot.svx b/js/_website/src/lib/templates/gradio/03_components/lineplot.svx index 1636ec4801102..658cb7b720767 100644 --- a/js/_website/src/lib/templates/gradio/03_components/lineplot.svx +++ b/js/_website/src/lib/templates/gradio/03_components/lineplot.svx @@ -10,6 +10,10 @@ import { style_formatted_text } from "$lib/text"; let obj = get_object("lineplot"); + let demo_code = `{ + 'week': x, + 'price': y + }` @@ -20,6 +24,42 @@ gradio.LinePlot(···) ``` + + + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/markdown.svx b/js/_website/src/lib/templates/gradio/03_components/markdown.svx index d57feb4244df8..149b453c0ffcc 100644 --- a/js/_website/src/lib/templates/gradio/03_components/markdown.svx +++ b/js/_website/src/lib/templates/gradio/03_components/markdown.svx @@ -20,6 +20,17 @@ gradio.Markdown(···) ``` + + + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/model3d.svx b/js/_website/src/lib/templates/gradio/03_components/model3d.svx index 1daa784095c80..42e2a9246d0e1 100644 --- a/js/_website/src/lib/templates/gradio/03_components/model3d.svx +++ b/js/_website/src/lib/templates/gradio/03_components/model3d.svx @@ -20,6 +20,16 @@ gradio.Model3D(···) ``` + + + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/multimodaltextbox.svx b/js/_website/src/lib/templates/gradio/03_components/multimodaltextbox.svx index 8161e217cd957..0ea5f7b07f854 100644 --- a/js/_website/src/lib/templates/gradio/03_components/multimodaltextbox.svx +++ b/js/_website/src/lib/templates/gradio/03_components/multimodaltextbox.svx @@ -20,6 +20,16 @@ gradio.MultimodalTextbox(···) ``` + + + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/number.svx b/js/_website/src/lib/templates/gradio/03_components/number.svx index 2d8545149e8a5..87a57e67828fa 100644 --- a/js/_website/src/lib/templates/gradio/03_components/number.svx +++ b/js/_website/src/lib/templates/gradio/03_components/number.svx @@ -20,6 +20,16 @@ gradio.Number(···) ``` + + + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/paramviewer.svx b/js/_website/src/lib/templates/gradio/03_components/paramviewer.svx index fcdd425b242e3..8d6ba59fd1dcd 100644 --- a/js/_website/src/lib/templates/gradio/03_components/paramviewer.svx +++ b/js/_website/src/lib/templates/gradio/03_components/paramviewer.svx @@ -10,6 +10,18 @@ import { style_formatted_text } from "$lib/text"; let obj = get_object("paramviewer"); + let demo_obj = `{ + "number": { + "type": "int | float", + "description": "The number to round", + "default": None + }, + "ndigits": { + "type": "int", + "description": "The number of digits to round to", + "default": "0" + } + }` @@ -20,6 +32,19 @@ gradio.ParamViewer(···) ``` + + + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/plot.svx b/js/_website/src/lib/templates/gradio/03_components/plot.svx index 15076f2f5bf30..c42afdfacb9c6 100644 --- a/js/_website/src/lib/templates/gradio/03_components/plot.svx +++ b/js/_website/src/lib/templates/gradio/03_components/plot.svx @@ -20,6 +20,28 @@ gradio.Plot(···) ``` + + + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/radio.svx b/js/_website/src/lib/templates/gradio/03_components/radio.svx index 2d7d3334c2e76..833b9ece4a769 100644 --- a/js/_website/src/lib/templates/gradio/03_components/radio.svx +++ b/js/_website/src/lib/templates/gradio/03_components/radio.svx @@ -20,6 +20,16 @@ gradio.Radio(···) ``` + + + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/scatterplot.svx b/js/_website/src/lib/templates/gradio/03_components/scatterplot.svx index 99aefd170b9b2..68defd6eac900 100644 --- a/js/_website/src/lib/templates/gradio/03_components/scatterplot.svx +++ b/js/_website/src/lib/templates/gradio/03_components/scatterplot.svx @@ -20,6 +20,44 @@ gradio.ScatterPlot(···) ``` + + + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/slider.svx b/js/_website/src/lib/templates/gradio/03_components/slider.svx index 7e072066f1c7e..ec6c0af0a925e 100644 --- a/js/_website/src/lib/templates/gradio/03_components/slider.svx +++ b/js/_website/src/lib/templates/gradio/03_components/slider.svx @@ -20,6 +20,16 @@ gradio.Slider(···) ``` + + + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/textbox.svx b/js/_website/src/lib/templates/gradio/03_components/textbox.svx index 7163faa1117d4..30e873f1faa85 100644 --- a/js/_website/src/lib/templates/gradio/03_components/textbox.svx +++ b/js/_website/src/lib/templates/gradio/03_components/textbox.svx @@ -20,6 +20,17 @@ gradio.Textbox(···) ``` + + + + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/uploadbutton.svx b/js/_website/src/lib/templates/gradio/03_components/uploadbutton.svx index a460433623c91..03860fef574f0 100644 --- a/js/_website/src/lib/templates/gradio/03_components/uploadbutton.svx +++ b/js/_website/src/lib/templates/gradio/03_components/uploadbutton.svx @@ -20,6 +20,22 @@ gradio.UploadButton(···) ``` + + + + ### Description ## {@html style_formatted_text(obj.description)} diff --git a/js/_website/src/lib/templates/gradio/03_components/video.svx b/js/_website/src/lib/templates/gradio/03_components/video.svx index 0f0bb2ae68a0e..4dbb5c2c1e02f 100644 --- a/js/_website/src/lib/templates/gradio/03_components/video.svx +++ b/js/_website/src/lib/templates/gradio/03_components/video.svx @@ -19,6 +19,16 @@ ```python gradio.Video(···) ``` + + + ### Description