-
Notifications
You must be signed in to change notification settings - Fork 323
Split the section about embed=true parameter of embedded Streamlit apps #709
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
whitphx
wants to merge
7
commits into
main
Choose a base branch
from
streamlit-embed-param
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+28
−7
Open
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0febb6d
Split the section about embed=true parameter of embedded Streamlit apps
whitphx 44a1ba5
Update
whitphx c5ea317
Update docs/hub/spaces-sdks-streamlit.md
whitphx 5f5ebea
Update docs/hub/spaces-sdks-streamlit.md
whitphx 34b05ca
Merge branch 'main' into streamlit-embed-param
whitphx 55a15cc
Replace NimaBoscarino/hotdog-streamlit with whitphx/hotdog-streamlit …
whitphx 492bd0b
Add inner-page anchor link
whitphx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
|
@@ -76,10 +76,34 @@ You can use the HTML `<iframe>` tag to embed a Streamlit Space as an inline fram | |
|
||
For example, the demo above can be embedded in these docs with the following tag: | ||
|
||
``` | ||
<iframe | ||
src="https://NimaBoscarino-hotdog-streamlit.hf.space" | ||
title="My awesome Streamlit Space" | ||
></iframe> | ||
``` | ||
|
||
<iframe | ||
src="https://NimaBoscarino-hotdog-streamlit.hf.space" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This Space is not working right now, so the embed won't work either. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I created a new Space with the same code in my namespace. |
||
frameborder="0" | ||
height="600" | ||
title="Streamlit app" | ||
class="container p-0 flex-grow space-iframe" | ||
allow="accelerometer; ambient-light-sensor; autoplay; battery; camera; document-domain; encrypted-media; fullscreen; geolocation; gyroscope; layout-animations; legacy-image-formats; magnetometer; microphone; midi; oversized-images; payment; picture-in-picture; publickey-credentials-get; sync-xhr; usb; vr ; wake-lock; xr-spatial-tracking" | ||
sandbox="allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-downloads" | ||
></iframe> | ||
|
||
Please note that, for the versions <1.19, scrolling is disabled and you'll need to set the height of the iframe enough to fit the embedded Streamlit app's content or use the auto-resizing technique described below. | ||
whitphx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Embed mode | ||
|
||
You can use the `embed=true` query parameter in the URL to activate the embed mode of the Streamlit app, removing some spacers and the footer for slim embeds. | ||
whitphx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
``` | ||
<iframe | ||
src="https://NimaBoscarino-hotdog-streamlit.hf.space?embed=true" | ||
title="My awesome Streamlit Space" | ||
height="364" | ||
></iframe> | ||
``` | ||
|
||
|
@@ -94,9 +118,6 @@ For example, the demo above can be embedded in these docs with the following tag | |
sandbox="allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-downloads" | ||
></iframe> | ||
|
||
Please note that we have added `?embed=true` to the URL, which activates the embed mode of the Streamlit app, removing some spacers and the footer for slim embeds. | ||
|
||
|
||
## Embed Streamlit Spaces with auto-resizing IFrames | ||
|
||
Streamlit has supported automatic iframe resizing since [1.17.0](https://docs.streamlit.io/library/changelog#version-1170) so that the size of the parent iframe is automatically adjusted to fit the content volume of the embedded Streamlit application. | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should we also include the
height
, as it is mentioned in your comment below? What about all theallow
settings, are they required?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.
The
height
used below is an ad-hoc optimization, so I think leaving this sample code as-is withoutheight
would be ok as an example.