import streamlit as st import streamlit.components.v1 as components # --- Page Configuration (Optional but good practice) --- st.set_page_config( page_title="newMATTER", page_icon=":computer:", layout="wide", #initial_sidebar_state="collapsed" ) st.markdown(""" """, unsafe_allow_html=True) if 'logged_in' not in st.session_state: st.session_state.logged_in = False if 'username' not in st.session_state: st.session_state.username = "" if 'projectname' not in st.session_state: st.session_state.projectname = "" 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.text("Authentication System") 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(): st.title("newMATTER") st.markdown("> Engineering Programmable Biology") tab1, tab2, tab3 = st.tabs(["PROTEIN ENGINEERING LAB", "EXECUTED OPERATIONS", "LAB OUTPUT"]) def SHOW_PROJECT_NAME(): st.header(f"setup your project @ {st.session_state.username}") project_name=st.text_input("enter project name ") st.session_state.projectname=project_name st.rerun() def SHOWTABS(): st.markdown(""" """, unsafe_allow_html=True) st.markdown('
🚨CAUTION !
', unsafe_allow_html=True) with tab1: console_container = st.container(height=150, border=False) with console_container: st.code(">>> System Online...", language="bash") # Use st.code for a console look user_input = st.text_area( "Protein Engineering Query", placeholder="Type your query here." ) 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") if st.session_state.projectname is not "": SHOWTABS() else: SHOW_PROJECT_NAME() if st.session_state.logged_in: APP() else: LOGIN()