Spaces:
Running
Running
File size: 2,717 Bytes
5f6ece1 7b2977f 5f6ece1 a8cbec9 5f6ece1 7b2977f 5f6ece1 6595b49 5f6ece1 7b2977f 6595b49 d9c9f01 6595b49 5d196be 6595b49 5d196be 6595b49 d667ecf 6595b49 d667ecf 6595b49 d667ecf a8cbec9 6595b49 7b2977f 6595b49 7b2977f 9401ff2 6595b49 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
import streamlit as st
# --- Page Configuration (Optional but good practice) ---
st.set_page_config(
page_title="BIOLAB",
page_icon=":computer:",
layout="wide",
#initial_sidebar_state="collapsed"
)
hardcodedlogin_user={
"usernames":["admin"],
"passwords":["123"]
}
def authenticate_user(username,password):
if username in hardcodedlogin_user["usernames"] and password in hardcodedlogin_user["passwords"]:
return True
else:
return False
def LOGIN():
st.title("🔐 Authentication System")
tab1, tab2 = st.tabs(["Login"])
with tab1:
st.subheader("Login to the application")
with st.form("login_form"):
username = st.text_input("Username")
password = st.text_input("Password", type="password")
login_button = st.form_submit_button("Login")
if login_button:
if username and password:
status = authenticate_user(username, password)
if status==True:
st.session_state.logged_in = True
st.session_state.username = username
st.rerun()
else:
st.error(message)
else:
st.warning("Please enter both username and password")
def APP():
tab1, tab2, tab3 = st.tabs(["BIOLAB", "OPERATIONS", "OUTPUT"])
with tab1:
console_container = st.container(height=150, border=True)
with console_container:
st.code(">>> System Online...", language="bash") # Use st.code for a console look
user_input = st.text_input(
"Protein Engineering Query",
placeholder="Type something lengthy here... It could be code, a story, or just a lot of thoughts."
)
if st.button("Execute", use_container_width=True):
if user_input:
# Simulate processing and append to the console
with console_container:
st.markdown(f"**>>> Processing input...**")
st.code(f"Input received ({len(user_input)} characters):\n{user_input[:200]}...", language="text") # Show first 200 chars
st.success("Task completed!")
else:
with console_container:
st.warning(">>> Please enter some text before processing.")
with tab2:
st.markdown("### Operations")
with tab3:
st.markdown("### Output")
#Route to appropriate page based on login status
if st.session_state.logged_in:
APP()
else:
LOGIN() |