Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,11 +19,15 @@ import pandas as pd
|
|
| 19 |
import numpy as np
|
| 20 |
from dotenv import load_dotenv
|
| 21 |
import re
|
|
|
|
|
|
|
| 22 |
|
| 23 |
warnings.filterwarnings("ignore", category=DeprecationWarning)
|
| 24 |
|
| 25 |
load_dotenv()
|
| 26 |
-
|
|
|
|
|
|
|
| 27 |
GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
|
| 28 |
|
| 29 |
llm = ChatGoogleGenerativeAI(model="gemini-1.5-pro",temperature=0,api_key=GOOGLE_API_KEY,convert_system_message_to_human=True)
|
|
@@ -36,6 +40,14 @@ st.set_page_config(
|
|
| 36 |
initial_sidebar_state="expanded",
|
| 37 |
)
|
| 38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
# Initialize session state for messages and banned users
|
| 40 |
if 'messages' not in st.session_state:
|
| 41 |
st.session_state.messages = [{"message": "Hi! How can I assist you today?", "is_user": False}]
|
|
|
|
| 19 |
import numpy as np
|
| 20 |
from dotenv import load_dotenv
|
| 21 |
import re
|
| 22 |
+
from auth0.v3.authentication import GetToken
|
| 23 |
+
from auth0.v3.management import Auth0
|
| 24 |
|
| 25 |
warnings.filterwarnings("ignore", category=DeprecationWarning)
|
| 26 |
|
| 27 |
load_dotenv()
|
| 28 |
+
client_id = os.getenv("client_id")
|
| 29 |
+
client_secret = os.getenv("client_secret")
|
| 30 |
+
auth_domain = os.getenv("auth_domain")
|
| 31 |
GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
|
| 32 |
|
| 33 |
llm = ChatGoogleGenerativeAI(model="gemini-1.5-pro",temperature=0,api_key=GOOGLE_API_KEY,convert_system_message_to_human=True)
|
|
|
|
| 40 |
initial_sidebar_state="expanded",
|
| 41 |
)
|
| 42 |
|
| 43 |
+
token = GetToken(auth_domain)
|
| 44 |
+
mgmt_api_token = token.client_credentials(
|
| 45 |
+
client_id,
|
| 46 |
+
client_secret,
|
| 47 |
+
'dev-u4kd3wndapfdk6dr.us.auth0.com'
|
| 48 |
+
)
|
| 49 |
+
auth0 = Auth0(auth_domain, mgmt_api_token['access_token'])
|
| 50 |
+
|
| 51 |
# Initialize session state for messages and banned users
|
| 52 |
if 'messages' not in st.session_state:
|
| 53 |
st.session_state.messages = [{"message": "Hi! How can I assist you today?", "is_user": False}]
|