Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -23,23 +23,20 @@ st.subheader("Chatbot", divider="rainbow", anchor=False)
|
|
23 |
# LOGIN
|
24 |
password = os.environ['PASSWORD']
|
25 |
|
26 |
-
# Create a login form container
|
27 |
-
login_container = st.container()
|
28 |
-
|
29 |
def login(password_input):
|
30 |
if password_input == password:
|
31 |
st.session_state.authenticated = True
|
32 |
-
|
33 |
-
else:
|
34 |
-
st.error("Invalid username or password")
|
35 |
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
|
40 |
-
#
|
41 |
if "authenticated" not in st.session_state or not st.session_state.authenticated:
|
42 |
-
|
|
|
|
|
43 |
|
44 |
client = Groq(
|
45 |
api_key=os.environ['GROQ_API_KEY'],
|
|
|
23 |
# LOGIN
|
24 |
password = os.environ['PASSWORD']
|
25 |
|
|
|
|
|
|
|
26 |
def login(password_input):
|
27 |
if password_input == password:
|
28 |
st.session_state.authenticated = True
|
29 |
+
return # Exit the function after successful login
|
|
|
|
|
30 |
|
31 |
+
st.error("Invalid username or password")
|
32 |
+
|
33 |
+
login_container = st.container()
|
34 |
|
35 |
+
# Password input and button inside the conditional block
|
36 |
if "authenticated" not in st.session_state or not st.session_state.authenticated:
|
37 |
+
with login_container:
|
38 |
+
password_input = st.text_input("Password", type="password")
|
39 |
+
st.button("authenticate", on_click=login, args=password_input)
|
40 |
|
41 |
client = Groq(
|
42 |
api_key=os.environ['GROQ_API_KEY'],
|