Download app.py from vikramentech/banking_management_system: direct link, hf CLI and curl.
- Browser
- Download file 2.01 kB
-
https://huggingface.co/spaces/vikramentech/banking_management_system/resolve/main/app.py
- Command line
-
hf download hf://spaces/vikramentech/banking_management_system/app.py
-
curl -L -o app.py https://huggingface.co/spaces/vikramentech/banking_management_system/resolve/main/app.py
2.01 kB
| import streamlit as st | |
| from main import Bank | |
| bank = Bank() | |
| st.title("🏦 Simple Bank System") | |
| menu = st.sidebar.selectbox( | |
| "Menu", | |
| ["Create Account", "Deposit", "Withdraw", "Account Details", "Delete Account"] | |
| ) | |
| # CREATE ACCOUNT | |
| if menu == "Create Account": | |
| st.header("Create Account") | |
| name = st.text_input("Name") | |
| age = st.number_input("Age", min_value=1) | |
| email = st.text_input("Email") | |
| pin = st.text_input("4 Digit Pin", type="password") | |
| if st.button("Create"): | |
| result = bank.create_account(name, age, email, int(pin)) | |
| if isinstance(result, dict): | |
| st.success("Account created!") | |
| st.write("Account Number:", result["accountNo"]) | |
| else: | |
| st.error(result) | |
| # DEPOSIT | |
| elif menu == "Deposit": | |
| st.header("Deposit Money") | |
| acc = st.text_input("Account Number") | |
| pin = st.text_input("Pin", type="password") | |
| amount = st.number_input("Amount", min_value=1) | |
| if st.button("Deposit"): | |
| result = bank.deposit(acc, int(pin), amount) | |
| st.info(result) | |
| # WITHDRAW | |
| elif menu == "Withdraw": | |
| st.header("Withdraw Money") | |
| acc = st.text_input("Account Number") | |
| pin = st.text_input("Pin", type="password") | |
| amount = st.number_input("Amount", min_value=1) | |
| if st.button("Withdraw"): | |
| result = bank.withdraw(acc, int(pin), amount) | |
| st.info(result) | |
| # DETAILS | |
| elif menu == "Account Details": | |
| st.header("Account Details") | |
| acc = st.text_input("Account Number") | |
| pin = st.text_input("Pin", type="password") | |
| if st.button("Show Details"): | |
| user = bank.get_details(acc, int(pin)) | |
| if user: | |
| st.json(user) | |
| else: | |
| st.error("Invalid account") | |
| # DELETE | |
| elif menu == "Delete Account": | |
| st.header("Delete Account") | |
| acc = st.text_input("Account Number") | |
| pin = st.text_input("Pin", type="password") | |
| if st.button("Delete"): | |
| result = bank.delete(acc, int(pin)) | |
| st.warning(result) |