Spaces:
Runtime error
Runtime error
import streamlit as st | |
import string | |
import secrets | |
user_name = [] | |
user_token = [] | |
user_balance = [] | |
count = len(user_name) | |
def generate_api_token(length): | |
characters = string.ascii_letters + string.digits | |
api_token = ''.join(secrets.choice(characters) for _ in range(length)) | |
return api_token | |
st.sidebar.title("KVI Crypto", help="IT IS FAKE!! Just for research") | |
st.sidebar.write("New crypto money") | |
name = st.sidebar.text_input("Enter name") | |
create = st.sidebar.button("Create wallet") | |
tok_inp = st.sidebar.text_input("Enter token to login") | |
login = st.sidebar.button("Login") | |
account, deposit, price = st.tabs(["Account", "Deposit", "Price"]) | |
price_value = 587 | |
if create: | |
new_user_token = generate_api_token(16) | |
user_name.append(name) | |
user_token.append(new_user_token) | |
user_balance.append(0) | |
index = count | |
balance = user_balance[index] | |
account.write(f"Your token: {new_user_token}. Remember it or copy!!") | |
account.header(f"Your balance: {balance}") | |
elif login: | |
if tok_inp in user_token: | |
innd = user_token.index(tok_inp) | |
balance = user_balance[innd] | |
name = user_name[innd] | |
account.write(f"Your token: {tok_inp}") | |
account.header(f"Your balance: {balance}") | |
deposit.subheader("Deposit money to wallet.") | |
how_much = deposit.number_input("Enter how much") | |
user_balance[innd] += how_much | |
price.header(f"Current KVI Crypto price is {price_value}$") |