Update app.py
Browse filesFixing the set_page_config
app.py
CHANGED
@@ -3,13 +3,14 @@ from upload import upload_file_to_vectara
|
|
3 |
from query import process_queries
|
4 |
import os
|
5 |
|
|
|
|
|
|
|
6 |
# Load external CSS
|
7 |
with open("style.css") as f:
|
8 |
st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html=True)
|
9 |
|
10 |
# Streamlit UI
|
11 |
-
st.set_page_config(page_title="STC Bank Assistant", layout="centered")
|
12 |
-
|
13 |
st.markdown("""
|
14 |
# Welcome to the STC Bank Assistant
|
15 |
|
@@ -18,13 +19,15 @@ st.markdown("""
|
|
18 |
#### Add additional files here
|
19 |
""")
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
25 |
uploaded_files = st.file_uploader("Upload PDF, DOCX, or XLSX files", type=["pdf", "docx", "xlsx"], accept_multiple_files=True)
|
26 |
|
27 |
-
if uploaded_files and customer_id and api_key and corpus_id:
|
28 |
for file in uploaded_files:
|
29 |
response = upload_file_to_vectara(file, customer_id, api_key, corpus_key)
|
30 |
st.write(f"Uploaded {file.name}: {response}")
|
|
|
3 |
from query import process_queries
|
4 |
import os
|
5 |
|
6 |
+
# Ensure set_page_config is the first Streamlit command
|
7 |
+
st.set_page_config(page_title="STC Bank Assistant", layout="centered")
|
8 |
+
|
9 |
# Load external CSS
|
10 |
with open("style.css") as f:
|
11 |
st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html=True)
|
12 |
|
13 |
# Streamlit UI
|
|
|
|
|
14 |
st.markdown("""
|
15 |
# Welcome to the STC Bank Assistant
|
16 |
|
|
|
19 |
#### Add additional files here
|
20 |
""")
|
21 |
|
22 |
+
# Fetch credentials from environment variables
|
23 |
+
customer_id = os.getenv("VECTARA_CUSTOMER_ID", "")
|
24 |
+
api_key = os.getenv("VECTARA_API_KEY", "")
|
25 |
+
corpus_id = os.getenv("VECTARA_CORPUS_ID", "")
|
26 |
+
corpus_key = os.getenv("VECTARA_CORPUS_KEY", "")
|
27 |
+
|
28 |
uploaded_files = st.file_uploader("Upload PDF, DOCX, or XLSX files", type=["pdf", "docx", "xlsx"], accept_multiple_files=True)
|
29 |
|
30 |
+
if uploaded_files and customer_id and api_key and corpus_id and corpus_key:
|
31 |
for file in uploaded_files:
|
32 |
response = upload_file_to_vectara(file, customer_id, api_key, corpus_key)
|
33 |
st.write(f"Uploaded {file.name}: {response}")
|