joao-vectara commited on
Commit
15736f4
·
verified ·
1 Parent(s): d7549c0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +39 -1
app.py CHANGED
@@ -19,7 +19,45 @@ async def main():
19
  await launch_bot()
20
 
21
  if __name__ == "__main__":
22
- st.set_page_config(page_title="Menarini Assistant", layout="wide")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
  nest_asyncio.apply()
25
  asyncio.run(main())
 
19
  await launch_bot()
20
 
21
  if __name__ == "__main__":
22
+ st.set_page_config(page_title="Proa Capital Assistant", layout="wide")
23
+ # Load external CSS for custom styling
24
+ with open("style.css", "r") as f:
25
+ st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html=True)
26
+
27
+ # Main UI layout
28
+ st.markdown(
29
+ """
30
+ <h1>Welcome to the Proa Capital Assistant</h1>
31
+
32
+ <div class="icon-container">
33
+ <!-- This yellowish box is the icon background -->
34
+ <div class="icon-box">💼</div>
35
+ <p class="icon-text">How may I help you?</p>
36
+ </div>
37
+
38
+ <h4>Add additional files here</h4>
39
+ """,
40
+ unsafe_allow_html=True
41
+ )
42
+
43
+ # Fetch credentials from environment variables
44
+ customer_id = os.getenv("VECTARA_CUSTOMER_ID", "")
45
+ api_key = os.getenv("VECTARA_API_KEY", "")
46
+ corpus_id = os.getenv("VECTARA_CORPUS_ID", "")
47
+ corpus_key = os.getenv("VECTARA_CORPUS_KEY", "")
48
+
49
+ # File uploader with drag-and-drop text + limit note
50
+ uploaded_files = st.file_uploader(
51
+ "Drag and drop file here\nLimit 200MB per file",
52
+ type=["pdf", "docx", "xlsx"],
53
+ accept_multiple_files=True
54
+ )
55
+
56
+ # If credentials exist and files are uploaded, handle them
57
+ if uploaded_files and customer_id and api_key and corpus_id and corpus_key:
58
+ for file in uploaded_files:
59
+ response = upload_file_to_vectara(file, customer_id, api_key, corpus_key)
60
+ st.write(f"Uploaded {file.name}: {response}")
61
 
62
  nest_asyncio.apply()
63
  asyncio.run(main())