Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -20,6 +20,26 @@ icon("⚡")
|
|
| 20 |
|
| 21 |
st.subheader("Chatbot", divider="rainbow", anchor=False)
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
client = Groq(
|
| 24 |
api_key=os.environ['GROQ_API_KEY'],
|
| 25 |
)
|
|
|
|
| 20 |
|
| 21 |
st.subheader("Chatbot", divider="rainbow", anchor=False)
|
| 22 |
|
| 23 |
+
|
| 24 |
+
# LOGIN
|
| 25 |
+
password = os.environ['PASSWORD']
|
| 26 |
+
|
| 27 |
+
# Create a login form
|
| 28 |
+
username = st.text_input("Username")
|
| 29 |
+
password_input = st.text_input("Password", type="password")
|
| 30 |
+
|
| 31 |
+
# Authenticate user
|
| 32 |
+
if st.button("Login"):
|
| 33 |
+
if username == "admin" and password_input == password:
|
| 34 |
+
st.session_state.authenticated = True
|
| 35 |
+
else:
|
| 36 |
+
st.error("Invalid username or password")
|
| 37 |
+
|
| 38 |
+
# Only allow access to the app if the user is authenticated
|
| 39 |
+
if "authenticated" not in st.session_state or not st.session_state.authenticated:
|
| 40 |
+
st.stop() # Stop the app from running if the user is not authenticated
|
| 41 |
+
|
| 42 |
+
|
| 43 |
client = Groq(
|
| 44 |
api_key=os.environ['GROQ_API_KEY'],
|
| 45 |
)
|