Spaces:
Running
Running
Update pages/biolab.py
Browse files- pages/biolab.py +16 -138
pages/biolab.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import streamlit as st
|
2 |
-
import
|
3 |
-
|
4 |
-
|
5 |
|
6 |
# --- Page Configuration (Optional but good practice) ---
|
7 |
st.set_page_config(
|
@@ -11,20 +11,14 @@ st.set_page_config(
|
|
11 |
#initial_sidebar_state="collapsed"
|
12 |
)
|
13 |
|
14 |
-
st.markdown("""
|
15 |
-
<style>
|
16 |
-
.main > div {
|
17 |
-
padding-top: 0rem;
|
18 |
-
}
|
19 |
-
</style>
|
20 |
-
""", unsafe_allow_html=True)
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
|
26 |
if 'logged_in' not in st.session_state:
|
27 |
st.session_state.logged_in = False
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
if 'username' not in st.session_state:
|
30 |
st.session_state.username = ""
|
@@ -34,133 +28,17 @@ if 'projectname' not in st.session_state:
|
|
34 |
|
35 |
|
36 |
|
37 |
-
hardcodedlogin_user={
|
38 |
-
|
39 |
-
"usernames":["admin"],
|
40 |
-
"passwords":["123"]
|
41 |
-
|
42 |
-
}
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
def authenticate_user(username,password):
|
47 |
-
|
48 |
-
if username in hardcodedlogin_user["usernames"] and password in hardcodedlogin_user["passwords"]:
|
49 |
-
return True
|
50 |
-
else:
|
51 |
-
return False
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
|
56 |
-
|
57 |
-
|
58 |
-
st.text("Authentication System")
|
59 |
|
60 |
-
|
61 |
-
st.subheader("Login to the application")
|
62 |
-
|
63 |
-
with st.form("login_form"):
|
64 |
-
username = st.text_input("Username")
|
65 |
-
password = st.text_input("Password", type="password")
|
66 |
-
login_button = st.form_submit_button("Login")
|
67 |
-
|
68 |
-
if login_button:
|
69 |
-
if username and password:
|
70 |
-
status = authenticate_user(username, password)
|
71 |
-
if status==True:
|
72 |
-
st.session_state.logged_in = True
|
73 |
-
st.session_state.username = username
|
74 |
-
st.rerun()
|
75 |
-
else:
|
76 |
-
st.error(message)
|
77 |
-
else:
|
78 |
-
st.warning("Please enter both username and password")
|
79 |
-
|
80 |
-
|
81 |
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
tab1, tab2, tab3 = st.tabs(["PROTEIN ENGINEERING LAB", "EXECUTED OPERATIONS", "LAB OUTPUT"])
|
88 |
-
|
89 |
-
def SHOW_PROJECT_NAME():
|
90 |
-
|
91 |
-
|
92 |
-
st.header(f"setup your project @ {st.session_state.username}")
|
93 |
-
|
94 |
-
project_name=st.text_input("enter project name ")
|
95 |
-
|
96 |
-
st.session_state.projectname=project_name
|
97 |
-
|
98 |
-
st.rerun()
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
def SHOWTABS():
|
103 |
-
|
104 |
-
|
105 |
-
st.markdown("""
|
106 |
-
<style>
|
107 |
-
@keyframes blink {
|
108 |
-
0% { opacity: 1; }
|
109 |
-
50% { opacity: 0; }
|
110 |
-
100% { opacity: 1; }
|
111 |
-
}
|
112 |
-
|
113 |
-
.blinking-text {
|
114 |
-
animation: blink 2s infinite;
|
115 |
-
font-size: 24px;
|
116 |
-
font-weight: bold;
|
117 |
-
color: red;
|
118 |
-
}
|
119 |
-
</style>
|
120 |
-
""", unsafe_allow_html=True)
|
121 |
-
|
122 |
-
st.markdown('<div class="blinking-text"> 🚨CAUTION ! </div>', unsafe_allow_html=True)
|
123 |
-
|
124 |
-
with tab1:
|
125 |
-
|
126 |
-
console_container = st.container(height=150, border=False)
|
127 |
-
|
128 |
-
with console_container:
|
129 |
-
st.code(">>> System Online...", language="bash") # Use st.code for a console look
|
130 |
-
|
131 |
-
user_input = st.text_area(
|
132 |
-
"Protein Engineering Query",
|
133 |
-
placeholder="Type your query here."
|
134 |
-
)
|
135 |
-
if st.button("Execute", use_container_width=True):
|
136 |
-
if user_input:
|
137 |
-
# Simulate processing and append to the console
|
138 |
-
with console_container:
|
139 |
-
st.markdown(f"**>>> Processing input...**")
|
140 |
-
st.code(f"Input received ({len(user_input)} characters):\n{user_input[:200]}...", language="text") # Show first 200 chars
|
141 |
-
st.success("Task completed!")
|
142 |
-
else:
|
143 |
-
with console_container:
|
144 |
-
st.warning(">>> Please enter some text before processing.")
|
145 |
-
|
146 |
-
|
147 |
-
with tab2:
|
148 |
-
st.markdown("### Operations")
|
149 |
-
|
150 |
-
with tab3:
|
151 |
-
st.markdown("### Output")
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
if st.session_state.projectname is not "":
|
156 |
-
SHOWTABS()
|
157 |
-
|
158 |
-
else:
|
159 |
-
SHOW_PROJECT_NAME()
|
160 |
|
161 |
|
|
|
|
|
162 |
|
163 |
-
|
164 |
-
APP()
|
165 |
-
else:
|
166 |
-
LOGIN()
|
|
|
1 |
import streamlit as st
|
2 |
+
from login import LOGIN
|
3 |
+
from register import REGISTER
|
4 |
+
from ui import APP
|
5 |
|
6 |
# --- Page Configuration (Optional but good practice) ---
|
7 |
st.set_page_config(
|
|
|
11 |
#initial_sidebar_state="collapsed"
|
12 |
)
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
if 'logged_in' not in st.session_state:
|
16 |
st.session_state.logged_in = False
|
17 |
+
|
18 |
+
|
19 |
+
if "registered" not in st.session_state:
|
20 |
+
st.session_state.registered=False
|
21 |
+
|
22 |
|
23 |
if 'username' not in st.session_state:
|
24 |
st.session_state.username = ""
|
|
|
28 |
|
29 |
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
+
if st.session_state.registered:
|
|
|
|
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
+
if st.session_state.logged_in:
|
36 |
+
APP()
|
37 |
+
else
|
38 |
+
LOGIN()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
|
41 |
+
else :
|
42 |
+
REGISTER()
|
43 |
|
44 |
+
|
|
|
|
|
|