test / app.py
Jangsoo's picture
Rename my_test.py to app.py
f7fc280
Raw History Blame Contribute Delete
1.48 kB
import streamlit as st
st.title('Unit 5. Layouts & Containers')
st.caption('์ฐธ์กฐ์‚ฌ์ดํŠธ: https://docs.streamlit.io/library/api-reference/layout')
# sidebar- with ์‚ฌ์šฉํ•˜๊ธฐ ๐Ÿ“ง ๐Ÿ“ฑ ๐Ÿ“ž
with st.sidebar:
st.header('1. Sidebar')
add_selectbox = st.sidebar.selectbox('์–ด๋–ป๊ฒŒ ์—ฐ๋ฝ๋“œ๋ฆด๊นŒ์š”?',
('Email', 'Mobile', 'Ofice Phone')
)
if add_selectbox == 'Email':
st.sidebar.title('๐Ÿ“ง')
elif add_selectbox == 'Mobile':
st.sidebar.title('๐Ÿ“ฑ')
elif add_selectbox == 'Ofice Phone':
st.sidebar.title('๐Ÿ“ž')
# columns
Cat = 'https://images.pexels.com/photos/2071873/pexels-photo-2071873.jpeg?auto=compress&cs=tinysrgb'
Dog = 'https://images.pexels.com/photos/3361739/pexels-photo-3361739.jpeg?auto=compress&cs=tinysrgb'
Owl = 'https://images.pexels.com/photos/3737300/pexels-photo-3737300.jpeg?auto=compress&cs=tinysrgb'
st.header('2. Columns')
col1, col2, col3 = st.columns(3)
with col1:
st.text('Cat')
st.image(Cat)
with col2:
st.text('Dog')
st.image(Dog)
with col3:
st.text('Owl')
st.image(Owl)
# # tabs - width=200
st.header('3. Tabs')
tab1, tab2, tab3 = st.tabs(['Cat', 'Dog', 'Owl'])
with tab1:
st.text('Cat')
st.image(Cat, caption='This is a cat', width=300)
with tab2:
st.text('Dog')
st.image(Dog, caption='This is a dog', width=300)
with tab3:
st.text('Owl')
st.image(Owl, caption='This is an owl', width=300)