DATA-WORLD-BLOG

Streamlit_Day01

👤horomi

Deliverable 🍄

https://learn-hero08.streamlit.app/

Create account

Lesson 📖

pip install streamlit
image block

streamlit hello
デモ
image block

streamlit run main.py
実行

image block
st.title('Streamlit horomi(^o^)v')

Tried elements

image block
df=pd.DataFrame(
    np.random.rand(20,3),
    columns=['a','b','c']
)
df

image block
st.line_chart(df)

https://docs.streamlit.io/library/api-reference/charts/st.line_chart

image block
st.area_chart(df)

https://docs.streamlit.io/library/api-reference/charts/st.area_chart

こんな機能も標準である👀

image block

image block
df=pd.DataFrame(
    np.random.rand(100,2)/[50,50]+[35.69,139.70],
    columns=['lat','lon']
)

st.map(df)

https://docs.streamlit.io/library/api-reference/charts/st.map

image block
from PIL import Image

img=Image.open('IMG_1720.PNG')
st.image(img,caption='horomi',use_column_width=True)

https://docs.streamlit.io/library/api-reference/media/st.image

image block
video_file = open('obsidian-ai.mov', 'rb')
video_bytes = video_file.read()

st.video(video_bytes)

image block
if st.checkbox('Show Image'):
    img=Image.open('IMG_1720.PNG')
    st.image(img,caption='horomi',use_column_width=True)

https://docs.streamlit.io/library/api-reference/widgets/st.checkbox

image block

image block
option=st.selectbox(
    'あなたが好きな数字を教えてください',
    list(range(1,11))
)
'あなたの好きな数字は、',option,'です'

https://docs.streamlit.io/library/api-reference/widgets/st.selectbox

image block
text=st.text_input('あなたの趣味を教えてください')
'あなたの趣味:',text,'です'

https://docs.streamlit.io/library/api-reference/widgets/st.text_input

image block
condition=st.slider('あなたの今の調子は?',0,100,50)
'コンディション:',condition

https://docs.streamlit.io/library/api-reference/widgets/st.slider

image block

image block
left_column,right_column=st.columns(2)
button=left_column.button('右カラムに文字を表示')
if button:
    right_column.write('ここは右カラムです')

image block

image block
expander=st.expander('問い合わせ')
expander.write('問い合わせ内容を書く')

https://docs.streamlit.io/library/api-reference/layout/st.expander

Deploy

https://www.youtube.com/watch?v=zp-kAt1Ih5k

Streamlit Sharing

image block

requirements.txt

streamlitのバージョン確認

pip freeze| grep strea

streamlit==1.12.0


その他

気になるBookmark 🍄