import streamlit as st

def main():
    st.title("액자 사진 갤러리")
    uploaded_files = st.file_uploader("여러 사진 파일을 업로드하세요.", accept_multiple_files=True)

    if uploaded_files:
        image_files = list(uploaded_files)
        image_files.sort(key=lambda x: x.name)

        st.write(f"총 {len(image_files) }개의 사진이 업로드 되었습니다.")

        for image_file in image_files:
            st.image(image_file, use_column_width=True, caption=image_file.name)

if __name__ == '__main__':
    main()
import streamlit as st

number = st.slider("숫자 선택", 0, 10)
st.write(f"선택한 숫자 {number}입니다.")
import streamlit as st

def main():
    st.title("액자 사진 갤러리")
    uploaded_files = st.file_uploader("여러 사진 파일을 업로드하세요.", accept_multiple_files=True)

    if uploaded_files:
        image_files = list(uploaded_files)
        image_files.sort(key=lambda x: x.name)

        st.write(f"총 {len(image_files)}개의 사진이 업로드 되었습니다.")

        index = st.slider("이미지 선택", 0, len(image_files)-1, 0)
        st.image(image_files[index], use_column_width=True, caption=image_files[index].name)

if __name__ == '__main__':
    main()

사전 준비

시작하기 전에 다음을 준비해야 합니다:

  1. Streamlit 설치:

    pip install streamlit
    
  2. 이미지 파일 준비:

  3. 코드 실행:

코드 주요 부분 설명

  1. Streamlit 라이브러리 임포트
import streamlit as st