Skip to content

Instantly share code, notes, and snippets.

@zentralwerkstatt
Last active October 3, 2022 08:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zentralwerkstatt/8362a44463894fba8f7229a7a7223108 to your computer and use it in GitHub Desktop.
Save zentralwerkstatt/8362a44463894fba8f7229a7a7223108 to your computer and use it in GitHub Desktop.
Run Streamlit apps from within Google Colab
!pip install streamlit
!npm install localtunnel
!streamlit run http://app.py &>/dev/null&
!npx localtunnel --port 8501
@BradKML
Copy link

BradKML commented Oct 3, 2022

Thank you, but it lacks a bit of description. Here is an example on how it can be used (borrowed from This notebook and This repo)

# package setup
!pip install streamlit
!npm install localtunnel
%%writefile app.py
import streamlit as st
import pandas as pd

spectra = st.file_uploader("upload CSV file", type={"csv"})
if spectra is not None:
  spectra_df = pd.read_csv(spectra)
  st.write(spectra_df)
# booting server
!streamlit run /content/app.py &>/content/logs.txt &
!npx localtunnel --port 8501

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment