Update app.py
Browse files
app.py
CHANGED
@@ -17,8 +17,36 @@ import google.generativeai as genai
|
|
17 |
|
18 |
|
19 |
|
|
|
|
|
20 |
load_dotenv()
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
togetherai_client = OpenAI(
|
23 |
api_key=os.getenv('TOGETHERAI_API_KEY'),
|
24 |
base_url="https://api.together.xyz/v1"
|
|
|
17 |
|
18 |
|
19 |
|
20 |
+
|
21 |
+
|
22 |
load_dotenv()
|
23 |
|
24 |
+
def check_password():
|
25 |
+
def password_entered():
|
26 |
+
if hmac.compare_digest(st.session_state["username"], os.environ.get("STREAMLIT_USERNAME", "")) and \
|
27 |
+
hmac.compare_digest(st.session_state["password"], os.environ.get("STREAMLIT_PASSWORD", "")):
|
28 |
+
st.session_state["password_correct"] = True
|
29 |
+
del st.session_state["password"]
|
30 |
+
del st.session_state["username"]
|
31 |
+
else:
|
32 |
+
st.session_state["password_correct"] = False
|
33 |
+
|
34 |
+
if "password_correct" not in st.session_state:
|
35 |
+
st.text_input("Username", key="username")
|
36 |
+
st.text_input("Password", type="password", key="password")
|
37 |
+
st.button("Login", on_click=password_entered)
|
38 |
+
return False
|
39 |
+
|
40 |
+
# Password correct
|
41 |
+
elif not st.session_state["password_correct"]:
|
42 |
+
st.text_input("Username", key="username")
|
43 |
+
st.text_input("Password", type="password", key="password")
|
44 |
+
st.button("Login", on_click=password_entered)
|
45 |
+
st.error("User not known or password incorrect")
|
46 |
+
return False
|
47 |
+
|
48 |
+
return True
|
49 |
+
|
50 |
togetherai_client = OpenAI(
|
51 |
api_key=os.getenv('TOGETHERAI_API_KEY'),
|
52 |
base_url="https://api.together.xyz/v1"
|