Deploy a Public Streamlit Web App for Free — Here’s How

https://miro.medium.com/max/1200/0*i1_8bGWsU6u32lz1

Original Source Here

Step 3. Deploy the App Publicly

3.1. Create a Streamlit Share Account

There are different options to host a Streamlit app, such as Heroku (You can find a tutorial in a Medium article). Here, I want to show you to use Streamlit Share — a free Streamlit web app sharing service provided by Streamlit. You can find more information at its official blog. Here are the general steps.

  1. Because the Streamlit team is still developing the platform, you need to request an invite to be able to deploy the app on Streamlit Share. You can submit a request here: https://streamlit.io/cloud
  2. Once you submit your request, it won’t take too long for them to approve your request. In my case, it took less than one day to receive the invite.
  3. You can now login into the Streamlit Share (https://share.streamlit.io/) with your GitHub authentication.

3.2. Update Your Script File

As you’ll see next, we’ll share our app in a public GitHub repository, and thus we don’t want to expose the Google sheet URL, which can be a potential security concern. Certainly, using a private Google Sheet or other databases with authentications is more secure.

Instead of specifying the URL in the script directly, you’ll save the URL in a shared app’s settings, from which you can access using the setting’s name.

# Original
gsheet_url = "the_link"
# Updated, when the URL is saved in the settings
gsheet_url = st.secrets["public_gsheets_url"]

3.3. Create a Public GitHub Repository

Once you update your script, it’s finally the time to make your app public (to some extent). What you’ll do is to create a public GitHub repository. I’m not going to expand how you can do that here. I use PyCharm, and I just need to use the built-in Git tool to create a repository easily.

3.4. Share the Web App!

Go to the Streamlit Share website, you can create a new web app by clicking “New App”, which will pop up the window shown below (left panel).

AI/ML

Trending AI/ML Article Identified & Digested via Granola by Ramsey Elbasheer; a Machine-Driven RSS Bot

%d bloggers like this: