
Streamlit とは?
簡単にデータ可視化するwebappを作成するライブラリ。pythonのフレームワークの有名なDjangoや Flaskと比較しても、圧倒的に簡単である。今回は、streamlitのdocs(ドキュメント)に沿って解説する。
目次
- streamlitをインストール
- Webappの立ち上げ
- サンプルコードをコピペして、作ってみる
- 実際にアプリケーションを作ってみる
1. streamlitをインストール
まずは、コマンドプロント or Terminal(VScodeの場合)で streamlitをインストール。
ここでは、VScodeを使った例としますので、以下Terminalと言います。

以下のように出てきたら、インストール完了!

2. web appの立ち上げ
いきなりwebapp立ち上げます。それくらい簡単です。早速コードを書いてみます。
作業は、以下の2つだけ。
・”hello_world.py”を作成する
・以下のようなコードを書いてみる。
import streamlit as st
st.title('hello_world')
コードはこれで終わりです。
続いて、Terminalに”streamlit run hello_world.py”と入力すると、、

”You can now view your Streamlit app in your browser.”
『ブラウザにStreamlitが立ち上がりました』とのことなので、表示されたURLを確認しましょう

これで完成です。
この後にデプロイの記述もありますが、それは別の記事に書きます。