1. 웹 서비스 형태 - Streamlit
1.1 웹 서비스를 만드는 과정
다른 조직의 도움 없이 빠르게 웹 서비스를 만드는 방법이 무엇일까?
Voila는 노트북환경에서 빠르게 프로토타입으로 보여주기 위한 방법이고
Streamlit은 웹페이지형태로 만들고 싶어서 만들게됐다
1.2 Streamlit의 대안
1)R의 Shiny
2) Flask, Fast API : 백엔드를 직접 구성 + 프론트엔드 작업도 진행
3) Dash : 제일 기능이 풍부한 Python 대시보드 라이브러리
4) Voila : Jupyter Notebook을 바로 시각화 가능
1.3 Streamlit Component
장점
- 파이썬 스크립트 코드를 조금만 수정하면 웹을 띄울 수 있음
- 백엔드 개발이나 HTTP 요청을 구현하지 않아도 됨
- 다양한 Component 제공해 대시보드 UI 구성할 수 있음
- Streamlit Cloud도 존재해서 쉽게 배포할 수 있음(단, Community Plan은 Public Repo만 가능)
- 화면 녹화 기능(Record) 존재
이 데모도 streamlit으로 만들어짐
https://albumentations-demo.herokuapp.com/
Streamlit
albumentations-demo.herokuapp.com
Streamlit • The fastest way to build and share data apps
Streamlit is an open-source app framework for Machine Learning and Data Science teams. Create beautiful data apps in hours, not weeks. All in pure Python. All for free.
streamlit.io
설치
pip install streamlit
실행
streamlit run streamlit-basic.py
Component
- Text
- Button
- Checkbox
- Pandas Dataframe
해당 링크 참고
https://docs.streamlit.io/library/api-reference
Streamlit Docs
Join the community Streamlit is more than just a way to make data apps, it’s also a community of creators that share their apps and ideas and help each other make their work better. Please come join us on the community forum. We love to hear your questio
docs.streamlit.io
https://share.streamlit.io/daniellewisdl/streamlit-cheat-sheet/app.py
https://share.streamlit.io/daniellewisdl/streamlit-cheat-sheet/app.py
share.streamlit.io
1.4 Session State
https://share.streamlit.io/streamlit/release-demos/0.84/0.84/streamlit_app.py
https://share.streamlit.io/streamlit/release-demos/0.84/0.84/streamlit_app.py
share.streamlit.io
https://blog.streamlit.io/session-state-for-streamlit/
1.5 @st.cache
매번 다시 실행하는 특성 때문에 데이터도 매번 다시 읽을 수 있음
이런 경우 @st.cache 데코레이터를 사용해 캐싱하면 좋음(캐싱 : 성능을 위해 메모리 등에 저장하는 행위)
데이터를 읽는 함수를 만들고, 데코레이터를 적용
'부스트캠프 AI Tech 2기 > 2기 Product Serving' 카테고리의 다른 글
Cloud (0) | 2021.12.10 |
---|---|
Linux & Shell Command (0) | 2021.12.10 |
Notebook 베이스 - Voila (0) | 2021.12.09 |
머신러닝 프로젝트 라이프 사이클 (0) | 2021.12.07 |
Product Serving (0) | 2021.12.07 |