joao-vectara commited on
Commit
9bb881d
·
verified ·
1 Parent(s): aa82568

Update app.py

Browse files

make changes to the UI

Files changed (1) hide show
  1. app.py +24 -11
app.py CHANGED
@@ -6,18 +6,25 @@ import os
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
-
17
- 🏡 **How may I help you?**
18
-
19
- #### Add additional files here
20
- """)
 
 
 
 
 
 
 
21
 
22
  # Fetch credentials from environment variables
23
  customer_id = os.getenv("VECTARA_CUSTOMER_ID", "")
@@ -25,8 +32,14 @@ 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)
 
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 for custom styling
10
+ with open("style.css", "r") as f:
11
  st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html=True)
12
 
13
+ # Main UI layout
14
+ st.markdown(
15
+ """
16
+ <h1>Welcome to the STC Bank Assistant</h1>
17
+
18
+ <div class="icon-container">
19
+ <!-- This yellowish box is the icon background -->
20
+ <div class="icon-box">💼</div>
21
+ <p class="icon-text">How may I help you?</p>
22
+ </div>
23
+
24
+ <h4>Add additional files here</h4>
25
+ """,
26
+ unsafe_allow_html=True
27
+ )
28
 
29
  # Fetch credentials from environment variables
30
  customer_id = os.getenv("VECTARA_CUSTOMER_ID", "")
 
32
  corpus_id = os.getenv("VECTARA_CORPUS_ID", "")
33
  corpus_key = os.getenv("VECTARA_CORPUS_KEY", "")
34
 
35
+ # File uploader with drag-and-drop text + limit note
36
+ uploaded_files = st.file_uploader(
37
+ "Drag and drop file here\nLimit 200MB per file",
38
+ type=["pdf", "docx", "xlsx"],
39
+ accept_multiple_files=True
40
+ )
41
 
42
+ # If credentials exist and files are uploaded, handle them
43
  if uploaded_files and customer_id and api_key and corpus_id and corpus_key:
44
  for file in uploaded_files:
45
  response = upload_file_to_vectara(file, customer_id, api_key, corpus_key)