Spaces:
Runtime error
Runtime error
Commit
Β·
eb8b7d0
1
Parent(s):
5227dfc
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,7 +16,10 @@ st.title('π€ AI Assistance For Website')
|
|
| 16 |
|
| 17 |
# Sidebar to capture the API keys
|
| 18 |
st.sidebar.title("πποΈ")
|
|
|
|
| 19 |
st.session_state['HuggingFace_API_Key']= st.sidebar.text_input("What's your HuggingFace API key?",type="password")
|
|
|
|
|
|
|
| 20 |
st.session_state['Pinecone_API_Key']= st.sidebar.text_input("What's your Pinecone API key?",type="password")
|
| 21 |
|
| 22 |
load_button = st.sidebar.button("Load data to Pinecone", key="load_button")
|
|
@@ -24,7 +27,7 @@ load_button = st.sidebar.button("Load data to Pinecone", key="load_button")
|
|
| 24 |
#If the bove button is clicked, pushing the data to Pinecone...
|
| 25 |
if load_button:
|
| 26 |
#Proceed only if API keys are provided
|
| 27 |
-
if st.session_state['HuggingFace_API_Key'] !="" and st.session_state['Pinecone_API_Key']!="" :
|
| 28 |
|
| 29 |
#Fetch data from site
|
| 30 |
site_data=get_website_data(constants.WEBSITE_URL)
|
|
@@ -39,12 +42,12 @@ if load_button:
|
|
| 39 |
st.write("Embeddings instance creation done...")
|
| 40 |
|
| 41 |
#Push data to Pinecone
|
| 42 |
-
push_to_pinecone(st.session_state['Pinecone_API_Key'],
|
| 43 |
st.write("Pushing data to Pinecone done...")
|
| 44 |
|
| 45 |
st.sidebar.success("Data pushed to Pinecone successfully!")
|
| 46 |
else:
|
| 47 |
-
st.sidebar.error("Ooopssss!!! Please provide API keys.....")
|
| 48 |
|
| 49 |
#********SIDE BAR Funtionality ended*******
|
| 50 |
|
|
|
|
| 16 |
|
| 17 |
# Sidebar to capture the API keys
|
| 18 |
st.sidebar.title("πποΈ")
|
| 19 |
+
st.session_state['Website_URL']= st.sidebar.text_input("Input the Website URL you want to Query against?")
|
| 20 |
st.session_state['HuggingFace_API_Key']= st.sidebar.text_input("What's your HuggingFace API key?",type="password")
|
| 21 |
+
st.session_state['Pinecone_ENV']= st.sidebar.text_input("What's your Pinecone Environment?")
|
| 22 |
+
st.session_state['Pinecone_Index']= st.sidebar.text_input("What's your Pinecone Index?")
|
| 23 |
st.session_state['Pinecone_API_Key']= st.sidebar.text_input("What's your Pinecone API key?",type="password")
|
| 24 |
|
| 25 |
load_button = st.sidebar.button("Load data to Pinecone", key="load_button")
|
|
|
|
| 27 |
#If the bove button is clicked, pushing the data to Pinecone...
|
| 28 |
if load_button:
|
| 29 |
#Proceed only if API keys are provided
|
| 30 |
+
if st.session_state['Website_URL'] !="" and st.session_state['HuggingFace_API_Key'] !="" and st.session_state['Pinecone_ENV'] !="" and st.session_state['Pinecone_API_Key']!="" :
|
| 31 |
|
| 32 |
#Fetch data from site
|
| 33 |
site_data=get_website_data(constants.WEBSITE_URL)
|
|
|
|
| 42 |
st.write("Embeddings instance creation done...")
|
| 43 |
|
| 44 |
#Push data to Pinecone
|
| 45 |
+
push_to_pinecone(st.session_state['Pinecone_API_Key'],st.session_state['Pinecone_ENV'],st.session_state['Pinecone_Index'],embeddings,chunks_data)
|
| 46 |
st.write("Pushing data to Pinecone done...")
|
| 47 |
|
| 48 |
st.sidebar.success("Data pushed to Pinecone successfully!")
|
| 49 |
else:
|
| 50 |
+
st.sidebar.error("Ooopssss!!! Please provide API keys and webstie URL.....")
|
| 51 |
|
| 52 |
#********SIDE BAR Funtionality ended*******
|
| 53 |
|