Vlad Bastina commited on
Commit
879871c
·
1 Parent(s): 52e7b83

cache model

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -8,6 +8,14 @@ def extract_text_from_docx(file_path):
8
  doc = Document(file_path)
9
  return " ".join([para.text.strip() for para in doc.paragraphs if para.text.strip()])
10
 
 
 
 
 
 
 
 
 
11
  # Streamlit App Configuration
12
  st.set_page_config(page_title="Zega AI Sales Agent", page_icon="🤖", layout="centered")
13
 
@@ -28,7 +36,7 @@ with st.spinner("Loading project information..."):
28
  doc2_text = extract_text_from_docx("Files/ZEGA AI Document Capabilities Overview for Clients (1).docx")
29
 
30
  # Initialize chatbot
31
- chatbot = GeminiQanA(doc1_text, doc2_text)
32
 
33
  # Initialize chat session
34
  if "messages" not in st.session_state:
 
8
  doc = Document(file_path)
9
  return " ".join([para.text.strip() for para in doc.paragraphs if para.text.strip()])
10
 
11
+ @st.cache_resource()
12
+ def load_chatbot():
13
+ with st.spinner("Loading project information..."):
14
+ doc1_text = extract_text_from_docx("Files/ZEGA AI Capabilities Overview for Clients (1).docx")
15
+ doc2_text = extract_text_from_docx("Files/ZEGA AI Document Capabilities Overview for Clients (1).docx")
16
+
17
+ return GeminiQanA(doc1_text, doc2_text)
18
+
19
  # Streamlit App Configuration
20
  st.set_page_config(page_title="Zega AI Sales Agent", page_icon="🤖", layout="centered")
21
 
 
36
  doc2_text = extract_text_from_docx("Files/ZEGA AI Document Capabilities Overview for Clients (1).docx")
37
 
38
  # Initialize chatbot
39
+ chatbot = load_chatbot()
40
 
41
  # Initialize chat session
42
  if "messages" not in st.session_state: