Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,7 @@ import streamlit as st
|
|
2 |
from utils import *
|
3 |
import constants
|
4 |
|
5 |
-
|
6 |
hide_streamlit_style = """
|
7 |
<style>
|
8 |
#MainMenu {visibility: hidden;}
|
@@ -19,28 +19,28 @@ if 'Pinecone_API_Key' not in st.session_state:
|
|
19 |
|
20 |
st.title("π TCE.edu Chat Assistant: Your Friendly Guide to Everything TCE! π")
|
21 |
|
22 |
-
|
23 |
|
24 |
-
|
25 |
|
26 |
-
|
27 |
-
|
28 |
|
29 |
-
|
30 |
-
|
31 |
|
32 |
-
|
33 |
-
|
34 |
|
35 |
-
|
36 |
-
|
37 |
|
38 |
-
|
39 |
-
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
|
45 |
prompt = st.text_input('How can I help you today β',key="prompt")
|
46 |
document_count = st.slider('Number of results to show π - (0 LOW || 5 HIGH)', 0, 5, 2,step=1)
|
|
|
2 |
from utils import *
|
3 |
import constants
|
4 |
|
5 |
+
st.set_page_config(initial_sidebar_state="collapsed")
|
6 |
hide_streamlit_style = """
|
7 |
<style>
|
8 |
#MainMenu {visibility: hidden;}
|
|
|
19 |
|
20 |
st.title("π TCE.edu Chat Assistant: Your Friendly Guide to Everything TCE! π")
|
21 |
|
22 |
+
st.sidebar.title("ποΈ")
|
23 |
|
24 |
+
load_button = st.sidebar.button("Load data to Pinecone", key="load_button")
|
25 |
|
26 |
+
if load_button:
|
27 |
+
if st.session_state['HuggingFace_API_Key'] !="" and st.session_state['Pinecone_API_Key']!="" :
|
28 |
|
29 |
+
site_data=get_website_data(constants.WEBSITE_URL)
|
30 |
+
st.write("β
Data fetched successfully!")
|
31 |
|
32 |
+
chunks_data=split_data(site_data)
|
33 |
+
st.write("βοΈ Data split into manageable parts!")
|
34 |
|
35 |
+
embeddings=create_embeddings()
|
36 |
+
st.write("π§ Model ready to understand your queries!")
|
37 |
|
38 |
+
push_to_pinecone(st.session_state['Pinecone_API_Key'],constants.PINECONE_ENVIRONMENT,constants.PINECONE_INDEX,embeddings,chunks_data)
|
39 |
+
st.write("π Data loaded into Pinecone for quick searching!")
|
40 |
|
41 |
+
st.sidebar.success("π Data successfully loaded into Pinecone!")
|
42 |
+
else:
|
43 |
+
st.sidebar.error("β Oops! Please provide your API keys.")
|
44 |
|
45 |
prompt = st.text_input('How can I help you today β',key="prompt")
|
46 |
document_count = st.slider('Number of results to show π - (0 LOW || 5 HIGH)', 0, 5, 2,step=1)
|