import streamlit as st
def main():
st.title("커피 주문 키오스크")
coffee_type = st.selectbox("커피 종류", ["아메리카노", "카페라떼", "카페모카"])
size = st.radio("사이트", ["Small", "Tall", "Grande"])
toppings = st.multiselect("토핑", ["시럽", "우유", "초코소스"])
if st.button("주문하기"):
st.write("주문이 완료되었습니다!")
st.write("커피 종류:", coffee_type)
st.write("사이즈:", size)
st.write("토핑:", toppings)
if __name__ == '__main__':
main()
사전 준비
시작하기 전에 다음을 준비해야 합니다:
Streamlit 설치:
bash
pip install streamlit
코드 실행:
코드를 .py 파일(예: coffee_kiosk.py)로 저장합니다.
터미널에서 다음 명령어로 실행합니다:
bash
streamlit run coffee_kiosk.py
실행 후, 브라우저에서 http://localhost:8501로 접속해 결과를 확인합니다.
코드 주요 부분 설명
import streamlit as st
def main():