Junaidb commited on
Commit
6595b49
·
verified ·
1 Parent(s): bae73e1

Update pages/biolab.py

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