본문 바로가기
Tools

Webpage with Streamlit

by wycho 2021. 10. 28.

https://streamlit.io/

Python에서 다루는 데이터의 정보를 web에서 볼 수 있게 해주는 Streamlit 이라는 편리한 툴이 있다.

 

python과 연동하여 작업하므로 HTML을 몰라도 되고, 보여주고 싶은 결과에 대한 홈페이지를 만들기 쉽다.

 

단점은 여러개의 tab으로 이루어진 multi-page를 만드는게 어렵다는 것이다.

$ pip install streamlit
$ pip install streamlit-aggrid

 

더보기
import pandas as pd
import numpy as np

import streamlit as st
import matplotlib.pyplot as plt
import altair as alt

# remove github icon
st.markdown(
    """
    <style>
    .css-1jc7ptx, .e1ewe7hr3, .viewerBadge_container__1QSob,
    .styles_viewerBadge__1yB5_, .viewerBadge_link__1S137,
    .viewerBadge_text__1JaDK {
        display: none;
    }
    </style>
    """,
    unsafe_allow_html=True
)

st.set_page_config(layout="wide")

st.title('TCGA RNA-seq data')

st.balloons()

fig = plt.figure()
ax = fig.add_subplot(1,1,1)

footerText = """
<style>
#MainMenu {
visibility:hidden ;
}

footer {
visibility : hidden ;
}

.footer {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
background-color: white;
color: black;
text-align: center;
}
</style>

<div class='footer'>
<p> Copyright @ 2021 , <a href="mailto:name@address.co.kr"> email address </a></p>
</div>
"""

실행

$ streamlit run file.py

# streamlit run file.py --server.port 123456

# streamlit run file.py --basic-auth="id:passwd"

 

https://discuss.streamlit.io/t/button-inside-button/12046/2

$ wget https://gist.github.com/tvst/036da038ab3e999a64497f42de966a92/raw/f0db274dd4d295ee173b4d52939be5ad55ae058d/SessionState.py

 

Example : Streamlit

- https://streamlit.io/gallery

- https://docs.streamlit.io/library/api-reference

- https://docs.streamlit.io/library/advanced-features

 

 

Example : Altair 

- https://github.com/altair-viz/altair

- https://partrita.github.io/posts/altair/

- https://altair-viz.github.io/gallery/

- https://github.com/altair-viz/altair/issues/1329

- https://www.analyticsvidhya.com/blog/2021/10/exploring-data-visualization-in-altair-an-interesting-alternative-to-seaborn/

 

 

Reference

- Overlapping plots, https://github.com/altair-viz/altair/issues/1328

- https://altair-viz.github.io/gallery/scatter_with_histogram.html

- https://github.com/PablocFonseca/streamlit-aggrid

- https://medium.com/analytics-vidhya/altair-interactive-multi-line-chart-59a29c9287d

- https://zzsza.github.io/mlops/2021/02/07/python-streamlit-dashboard/

- https://github.com/tvst/st-annotated-text

 

 

 

 

 

'Tools' 카테고리의 다른 글

Heroku - App publication  (0) 2021.12.02
WEB-based analysis  (0) 2021.11.30
Marp - Markdown to PPT  (0) 2021.10.13
GSEA  (0) 2021.10.01
SCSA - scRNA-seq Annotation  (0) 2021.09.01

댓글