sai-lohith/streamlit_docs huggingface dataset:
DocumentationsearchSearchrocket_launchGet startedInstallationaddFundamentalsaddFirst stepsaddcodeDevelopConceptsaddAPI referenceaddTutorialsaddQuick referenceaddweb_assetDeployConceptsaddStreamlit Community CloudaddStreamlit in Snowflakeopen_in_newOther platformsaddschoolKnowledge baseFAQInstalling dependenciesDeployment issuesHome/Knowledge base/FAQ/How to insert elements out of order?How to insert elements out of order?
You can use the st.empty method as a placeholder,
to "save" a slot in your app that you can use later.
st.text('This will appear first')
# Appends some text to the app.

my_slot1 = st.empty()
# Appends an empty slot to the app. We'll use this later.

my_slot2 = st.empty()
# Appends another empty slot.

st.text('This will appear last')
# Appends some more text to the app.

my_slot1.text('This will appear second')
# Replaces the first empty slot with a text string.

my_slot2.line_chart(np.random.randn(20, 2))
# Replaces the second empty slot with a chart.
Previous: How do I upgrade to the latest version of Streamlit?Next: How can I make st.pydeck_chart use custom Mapbox styles?forumStill have questions?Our forums are full of helpful information and Streamlit experts.HomeContact UsCommunity© 2024 Snowflake Inc.Cookie policy
DocumentationsearchSearchrocket_launchGet startedInstallationaddFundamentalsaddFirst stepsaddcodeDevelopConceptsaddAPI referenceaddTutorialsaddQuick referenceaddweb_assetDeployConceptsaddStreamlit Community CloudremoveGet startedaddDeploy your appaddManage your appaddShare your appaddManage your accountremoveSign in & sign outWorkspace settingsManage your GitHub connectionUpdate your emailDelete your accountTroubleshootingStreamlit in Snowflakeopen_in_newOther platformsaddschoolKnowledge baseFAQInstalling dependenciesDeployment issuesHome/Deploy/Streamlit Community Cloud/Manage your accountManage your account
You can Update your email or Delete your account entirely through Workspace settings.
When using Streamlit Community Cloud, you have two identities behind your account: a primary identity (Google or email) and source control (GitHub). Your primary identity allows other users to share private apps with you and grant you access to their analytics. Your source control identity allows you to deploy apps from GitHub repositories and manage them through your Streamlit Community Cloud workspace.
Access your workspace settings
To manage your account, sign in to share.streamlit.io and click "Settings" in the top right corner to access your workspace settings.

Learn more about how to Update your email and Delete your account.Previous: Share your appNext: Sign in & sign outforumStill have questions?Our forums are full of helpful information and Streamlit experts.HomeContact UsCommunity© 2024 Snowflake Inc.Cookie policy
DocumentationsearchSearchrocket_launchGet startedInstallationaddFundamentalsaddFirst stepsaddcodeDevelopConceptsaddAPI referenceaddTutorialsaddQuick referenceaddweb_assetDeployConceptsaddStreamlit Community CloudaddStreamlit in Snowflakeopen_in_newOther platformsaddschoolKnowledge baseFAQInstalling dependenciesDeployment issuesHome/Knowledge base/Deployment issues/Unable to edit or delete apps in Streamlit Community Cloud after modifying GitHub usernameUnable to edit or delete apps in Streamlit Community Cloud after modifying GitHub username
Problem
After updating the GitHub username, apps cannot be edited or deleted from Streamlit Community Cloud.
Solution

Support can delete your old applications that were deployed before updating the GitHub username.
Once deleted, you can redeploy the applications using the new GitHub username.
Please contact Support with a list of the URLs for the apps you need to be deleted.
Previous: Upgrade the Streamlit version of your app on Streamlit Community CloudNext: Huh. This is isn't supposed to happen message after trying to log inforumStill have questions?Our forums are full of helpful information and Streamlit experts.HomeContact UsCommunity© 2024 Snowflake Inc.Cookie policy
DocumentationsearchSearchrocket_launchGet startedInstallationaddFundamentalsaddFirst stepsaddcodeDevelopConceptsaddAPI referenceaddTutorialsaddQuick referenceaddweb_assetDeployConceptsaddStreamlit Community CloudaddStreamlit in Snowflakeopen_in_newOther platformsaddschoolKnowledge baseFAQInstalling dependenciesDeployment issuesHome/Knowledge base/Deployment issues/Invoking a Python subprocess in a deployed Streamlit appInvoking a Python subprocess in a deployed Streamlit app
Problem
Let's suppose you want to invoke a subprocess to run a Python script script.py in your deployed Streamlit app streamlit_app.py. For example, the machine learning library Ludwig is run using a command-line interface, or maybe you want to run a bash script or similar type of process from Python.
You have tried the following, but run into dependency issues for script.py, even though you have specified your Python dependencies in a requirements file:
# streamlit_app.py
import streamlit as st
import subprocess

subprocess.run(["python", "script.py"])

Solution
When you run the above code block, you will get the version of Python that is on the system path—not necessarily the Python executable installed in the virtual environment that the Streamlit code is running under.
The solution is to detect the Python executable directly with sys.executable:
# streamlit_app.py
import streamlit as st
import subprocess
import sys

subprocess.run([f"{sys.executable}", "script.py"])

This ensures that script.py is running under the same Python executable as your Streamlit code—where your Python dependencies are installed.
Relevant links

https://stackoverflow.com/questions/69947867/run-portion-of-python-code-in-parallel-from-a-streamlit-app/69948545#69948545
https://discuss.streamlit.io/t/modulenotfounderror-no-module-named-cv2-streamlit/18319/3?u=snehankekre
https://docs.python.org/3/library/sys.html#sys.executable
Previous: How do I increase the upload limit of st.file_uploader on Streamlit Community Cloud?Next: Organizing your apps with workspaces on Streamlit Community CloudforumStill have questions?Our forums are full of helpful information and Streamlit experts.HomeContact UsCommunity© 2024 Snowflake Inc.Cookie policy
DocumentationsearchSearchrocket_launchGet startedInstallationaddFundamentalsaddFirst stepsaddcodeDevelopConceptsaddAPI referenceaddTutorialsaddQuick referenceaddweb_assetDeployConceptsaddStreamlit Community CloudremoveGet startedaddDeploy your appaddManage your appaddShare your appaddManage your accountremoveSign in & sign outWorkspace settingsManage your GitHub connectionUpdate your emailDelete your accountTroubleshootingStreamlit in Snowflakeopen_in_newOther platformsaddschoolKnowledge baseFAQInstalling dependenciesDeployment issuesHome/Deploy/Streamlit Community Cloud/Manage your account/Sign in & sign outSign in & sign out
Once you've created your account, you can sign in to share.streamlit.io and follow the steps below.

Sign in with Google

Visit share.streamlit.io and click "Continue with Google".



Enter your Google account credentials.



If your account is already linked to GitHub, you may be immediately prompted to sign in with GitHub. Once you have signed in, you can Explore your workspace!. 🎈

Sign in with GitHub

Visit share.streamlit.io and click "Continue with GitHub".



Enter your GitHub credentials.



Once you have signed in to GitHub, you can Explore your workspace!. 🎈

Sign in with Email

Visit share.streamlit.io and enter the email you used to create your Streamlit Community Cloud account. Click "Continue with email".



You will see a confirmation message asking you to check your email.



Check your inbox for an email with the subject "Sign in to Streamlit Cloud". Click the link in the email to sign in to Streamlit Community Cloud. Note that this link will expire in 15 minutes and can only be used once.



Once you click the link in your email, you can Explore your workspace!. 🎈

Sign out of your account
From your workspace, click on your workspace name in the upper-right corner. Click "Sign out".
Previous: Manage your accountNext: Workspace settingsforumStill have questions?Our forums are full of helpful information and Streamlit experts.HomeContact UsCommunity© 2024 Snowflake Inc.Cookie policy
DocumentationsearchSearchrocket_launchGet startedInstallationaddFundamentalsaddFirst stepsaddcodeDevelopConceptsaddAPI referenceaddTutorialsaddQuick referenceaddweb_assetDeployConceptsaddStreamlit Community CloudaddStreamlit in Snowflakeopen_in_newOther platformsaddschoolKnowledge baseFAQInstalling dependenciesDeployment issuesHome/Knowledge base/Installing dependencies/How to install a package not on PyPI or Conda but available on GitHubHow to install a package not on PyPI/Conda but available on GitHub
Overview
Are you trying to deploy your app to Streamlit Community Cloud, but don't know how to specify a Python dependency in your requirements file that is available on a public GitHub repo but not any package index like PyPI or Conda? If so, continue reading to find out how!
Let's suppose you want to install SomePackage and its Python dependencies from GitHub, a hosting service for the popular version control system (VCS) Git. And suppose SomePackage is found at the the following URL: https://github.com/SomePackage.git.
pip (via requirements.txt) supports installing from GitHub. This support requires a working executable to be available (for Git). It is used through a URL prefix: git+.
Specify the GitHub web URL
To install SomePackage, innclude the following in your requirements.txt file:
git+https://github.com/SomePackage#egg=SomePackage

You can even specify a "git ref" such as branch name, a commit hash or a tag name, as shown in the examples below.
Specify a Git branch name
Install SomePackage by specifying a branch name such as main, master, develop, etc, in requirements.txt:
git+https://github.com/SomePackage.git@main#egg=SomePackage

Specify a commit hash
Install SomePackage by specifying a commit hash in requirements.txt:
git+https://github.com/SomePackage.git@eb40b4ff6f7c5c1e4366cgfg0671291bge918#egg=SomePackage

Specify a tag
Install SomePackage by specifying a tag in requirements.txt:
git+https://github.com/SomePackage.git@v1.1.0#egg=SomePackage

Limitations
It is currently not possible to install private packages from private GitHub repos using the URI form:
git+https://{token}@github.com/user/project.git@{version}

where version is a tag, a branch, or a commit. And token is a personal access token with read only permissions. Streamlit Community Cloud only supports installing public packages from public GitHub repos.Previous: Installing dependenciesNext: ImportError libGL.so.1 cannot open shared object file No such file or directoryforumStill have questions?Our forums are full of helpful information and Streamlit experts.HomeContact UsCommunity© 2024 Snowflake Inc.Cookie policy
DocumentationsearchSearchrocket_launchGet startedInstallationaddFundamentalsaddFirst stepsaddcodeDevelopConceptsaddAPI referenceaddTutorialsaddQuick referenceaddweb_assetDeployConceptsaddStreamlit Community CloudaddStreamlit in Snowflakeopen_in_newOther platformsaddschoolKnowledge baseFAQInstalling dependenciesDeployment issuesHome/Knowledge base/FAQ/How do I get dataframe row selections from a user?How do I get dataframe row-selections from a user?
At the moment, st.dataframe and st.data_editor do not natively support passing user-selected rows to the Python backend. We are working to support this in the future. For now, if you need to get row-selections from a user, you can accomplish this by adding an extra Checkbox column) to your dataframe and using st.data_editor. You can use this extra column to collect a user's selection(s).
Example
In the following example, we define a function which accepts a dataframe and returns the rows selected by a user. Within the function, the dataframe is copied to prevent mutating it. We insert a temporary "Select" column into the copied dataframe before passing the copied data into st.data_editor. We have disabled editing for all other columns, but you can make them editable if desired. After filtering the dataframe and dropping the temporary column, our function returns the selected rows.
import streamlit as st
import numpy as np
import pandas as pd

df = pd.DataFrame(
    {
        "Animal": ["Lion", "Elephant", "Giraffe", "Monkey", "Zebra"],
        "Habitat": ["Savanna", "Forest", "Savanna", "Forest", "Savanna"],
        "Lifespan (years)": [15, 60, 25, 20, 25],
        "Average weight (kg)": [190, 5000, 800, 10, 350],
    }
)

def dataframe_with_selections(df):
    df_with_selections = df.copy()
    df_with_selections.insert(0, "Select", False)

    # Get dataframe row-selections from user with st.data_editor
    edited_df = st.data_editor(
        df_with_selections,
        hide_index=True,
        column_config={"Select": st.column_config.CheckboxColumn(required=True)},
        disabled=df.columns,
    )

    # Filter the dataframe using the temporary column, then drop the column
    selected_rows = edited_df[edited_df.Select]
    return selected_rows.drop('Select', axis=1)


selection = dataframe_with_selections(df)
st.write("Your selection:")
st.write(selection)
Previous: How to download a Pandas DataFrame as a CSV?Next: How do I upgrade to the latest version of Streamlit?forumStill have questions?Our forums are full of helpful information and Streamlit experts.HomeContact UsCommunity© 2024 Snowflake Inc.Cookie policy
DocumentationsearchSearchrocket_launchGet startedInstallationaddFundamentalsaddFirst stepsaddcodeDevelopConceptsaddAPI referenceaddTutorialsremoveExecution flowaddConnect to data sourcesaddMultipage appsaddWork with LLMsremoveBuild a basic LLM chat appBuild an LLM app using LangChainQuick referenceaddweb_assetDeployConceptsaddStreamlit Community CloudaddStreamlit in Snowflakeopen_in_newOther platformsaddschoolKnowledge baseFAQInstalling dependenciesDeployment issuesHome/Develop/Tutorials/Work with LLMsBuild LLM apps
Build a basic chat appBuild a simple OpenAI chat app to get started with Streamlit's chat elements.Build an LLM app using LangChainBuild a chat app using the LangChain framework with OpenAI.Previous: Multipage appsNext: Build a basic LLM chat appforumStill have questions?Our forums are full of helpful information and Streamlit experts.HomeContact UsCommunity© 2024 Snowflake Inc.Cookie policy
DocumentationsearchSearchrocket_launchGet startedInstallationaddFundamentalsaddFirst stepsaddcodeDevelopConceptsaddAPI referenceremovePAGE ELEMENTSWrite and magicaddText elementsaddData elementsaddChart elementsaddInput widgetsaddMedia elementsaddLayouts and containersaddChat elementsaddStatus elementsaddThird-party componentsopen_in_newAPPLICATION LOGICNavigation and pagesaddExecution flowremovest.dialogst.formst.form_submit_buttonst.fragmentst.rerunst.stopCaching and stateaddConnections and secretsaddCustom componentsaddUtilitiesaddConfigurationaddTOOLSApp testingaddCommand lineaddTutorialsaddQuick referenceaddweb_assetDeployConceptsaddStreamlit Community CloudaddStreamlit in Snowflakeopen_in_newOther platformsaddschoolKnowledge baseFAQInstalling dependenciesDeployment issuesHome/Develop/API reference/Execution flowExecution flow
Change execution
By default, Streamlit apps execute the script entirely, but we allow some functionality to handle control flow in your applications.
Modal dialogsInsert a modal dialog that can rerun independently from the rest of the script.@st.experimental_dialog("Sign up")
def email_form():
    name = st.text_input("Name")
    email = st.text_input("Email")
Partial rerunsDefine a fragment to rerun independently from the rest of the script.@st.experimental_fragment(run_every="10s")
def fragment():
    df = get_data()
    st.line_chart(df)
Rerun scriptRerun the script immediately.st.rerun()
Stop executionStops execution immediately.st.stop()

Group multiple widgets
By default, Streamlit reruns your script everytime a user interacts with your app.
However, sometimes it's a better user experience to wait until a group of related
widgets is filled before actually rerunning the script. That's what st.form is for!
FormsCreate a form that batches elements together with a “Submit" button.with st.form(key='my_form'):
    name = st.text_input("Name")
    email = st.text_input("Email")
    st.form_submit_button("Sign up")
Form submit buttonDisplay a form submit button.with st.form(key='my_form'):
    name = st.text_input("Name")
    email = st.text_input("Email")
    st.form_submit_button("Sign up")

Third-party componentsThese are featured components created by our lovely community. If you don't see what you're looking for, check out our Components Hub app and Streamlit Extras for more examples and inspiration!AutorefreshForce a refresh without tying up a script. Created by @kmcgrady.from streamlit_autorefresh import st_autorefresh

st_autorefresh(interval=2000, limit=100,
  key="fizzbuzzcounter")
PydanticAuto-generate Streamlit UI from Pydantic Models and Dataclasses. Created by @lukasmasuch.import streamlit_pydantic as sp

sp.pydantic_form(key="my_form",
  model=ExampleModel)
Streamlit PagesAn experimental version of Streamlit Multi-Page Apps. Created by @blackary.from st_pages import Page, show_pages, add_page_title

show_pages([ Page("streamlit_app.py", "Home", "🏠"),
  Page("other_pages/page2.py", "Page 2", ":books:"), ])
Previous: Navigation and pagesNext: st.dialogforumStill have questions?Our forums are full of helpful information and Streamlit experts.HomeContact UsCommunity© 2024 Snowflake Inc.Cookie policy
DocumentationsearchSearchrocket_launchGet startedInstallationaddFundamentalsaddFirst stepsaddcodeDevelopConceptsremoveCOREArchitecture & executionaddMultipage appsaddApp designaddADDITIONALConnections and secretsaddCustom componentsaddConfiguration and themingremoveConfiguration optionsHTTPS supportServing static filesCustomize your themeApp testingaddAPI referenceaddTutorialsaddQuick referenceaddweb_assetDeployConceptsaddStreamlit Community CloudaddStreamlit in Snowflakeopen_in_newOther platformsaddschoolKnowledge baseFAQInstalling dependenciesDeployment issuesHome/Develop/Concepts/Configuration and themingConfigure and customize your app
Configuration optionsUnderstand they types of options available to you through Streamlit configuration.HTTPS supportUnderstand how to configure SSL and TLS for your Streamlit app.Static file servingUnderstand how to host files alongside your app to make them accessible by URL. Use this if you want to point to files with raw HTML.ThemingUnderstand how to use the theming configuration options to customize the color and appearance of your app.Previous: Custom componentsNext: Configuration optionsforumStill have questions?Our forums are full of helpful information and Streamlit experts.HomeContact UsCommunity© 2024 Snowflake Inc.Cookie policy
DocumentationsearchSearchrocket_launchGet startedInstallationaddFundamentalsaddFirst stepsaddcodeDevelopConceptsaddAPI referenceaddTutorialsaddQuick referenceaddweb_assetDeployConceptsaddStreamlit Community CloudaddStreamlit in Snowflakeopen_in_newOther platformsremoveDockerKubernetesschoolKnowledge baseFAQInstalling dependenciesDeployment issuesHome/Deploy/Other platformsDeployment tutorials
This sections contains step-by-step guides on how to deploy Streamlit apps to various cloud platforms and services. We have deployment guides for:
Streamlit Community CloudDockerKubernetes
While we work on official Streamlit deployment guides for other hosting providers, here are some user-submitted tutorials for different cloud services:

How to Deploy Streamlit to a Free Amazon EC2 instance, by Rahul Agarwal.
Host Streamlit on Azure, by Richard Peterson.
How to deploy Streamlit apps to Google App Engine, by Yuichiro Tachibana (Tsuchiya).
Host Streamlit on Heroku, by Maarten Grootendorst.
Deploy Streamlit on Ploomber Cloud, by Ido Michael.
Host Streamlit on 21YunBox, by Toby Lei.
Community-supported deployment wiki.
Previous: Streamlit in SnowflakeNext: DockerforumStill have questions?Our forums are full of helpful information and Streamlit experts.HomeContact UsCommunity© 2024 Snowflake Inc.Cookie policy
DocumentationsearchSearchrocket_launchGet startedInstallationaddFundamentalsaddFirst stepsaddcodeDevelopConceptsaddAPI referenceaddTutorialsaddQuick referenceaddweb_assetDeployConceptsaddStreamlit Community CloudaddStreamlit in Snowflakeopen_in_newOther platformsaddschoolKnowledge baseFAQInstalling dependenciesDeployment issuesHome/Knowledge base/Deployment issues/Organizing your apps with workspaces on Streamlit Community CloudOrganizing your apps with workspaces on Streamlit Community Cloud
Streamlit Community Cloud is organized into workspaces, which automatically group your apps according to the corresponding GitHub repository's owner. If you are part of multiple repositories, then you will have multiple workspaces.

Personal workspace
If an app's GitHub repository is owned by you, the app will appear in your personal workspace, named "<YourGitHubHandle>".

Organization workspace
If an app's GitHub repository is owned by an organization (such as your company), the app will appear in a separate workspace, named "<GitHubOrganizationHandle>".

Workspaces with view access
You will also have access to any workspaces containing app(s) for which you only have view access. These apps will have a "view-only" tooltip when you click on their respective overflow menu icons (⋮).

Switching between workspaces
To switch between workspaces, click on the workspace listed in the top right corner, then select the desired workspace name.

push_pinNoteIf you have further questions about workspaces on Streamlit Community Cloud, please emails us at success@streamlit.io.Previous: Invoking a Python subprocess in a deployed Streamlit appNext: App is not loading when running remotelyforumStill have questions?Our forums are full of helpful information and Streamlit experts.HomeContact UsCommunity© 2024 Snowflake Inc.Cookie policy
DocumentationsearchSearchrocket_launchGet startedInstallationaddFundamentalsaddFirst stepsaddcodeDevelopConceptsaddAPI referenceremovePAGE ELEMENTSWrite and magicaddText elementsaddData elementsaddChart elementsaddInput widgetsaddMedia elementsaddLayouts and containersaddChat elementsaddStatus elementsaddThird-party componentsopen_in_newAPPLICATION LOGICNavigation and pagesaddExecution flowaddCaching and stateaddConnections and secretsremoveSECRETSst.secretssecrets.tomlCONNECTIONSst.connectionSnowflakeConnectionSQLConnectionBaseConnectionSnowparkConnectiondeleteCustom componentsaddUtilitiesaddConfigurationaddTOOLSApp testingaddCommand lineaddTutorialsaddQuick referenceaddweb_assetDeployConceptsaddStreamlit Community CloudaddStreamlit in Snowflakeopen_in_newOther platformsaddschoolKnowledge baseFAQInstalling dependenciesDeployment issuesHome/Develop/API reference/Connections and secrets/st.secretsst.secrets
st.secrets provides a dictionary-like interface to access secrets stored in a secrets.toml file. It behaves similarly to st.session_state. st.secrets can be used with both key and attribute notation. For example, st.secrets.your_key and st.secrets["your_key"] refer to the same value. For more information about using st.secrets, see Secrets management.
secrets.toml
Secrets can be saved globally or per-project. When both types of secrets are saved, Streamlit will combine the saved values but give precedence to per-project secrets if there are duplicate keys. For information on how to format and locate your secrets.toml file for your development environment, see secrets.toml.
Example
OpenAI_key = "your OpenAI key"
whitelist = ["sally", "bob", "joe"]

[database]
user = "your username"
password = "your password"

In your Streamlit app, the following values would be true:
st.secrets["OpenAI_key"] == "your OpenAI key"
"sally" in st.secrets.whitelist
st.secrets["database"]["user"] == "your username"
st.secrets.database.password == "your password"
Previous: Connections and secretsNext: secrets.tomlforumStill have questions?Our forums are full of helpful information and Streamlit experts.HomeContact UsCommunity© 2024 Snowflake Inc.Cookie policy