PyaeSoneK commited on
Commit
8dfa441
·
1 Parent(s): f01eaea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -13
app.py CHANGED
@@ -116,20 +116,18 @@ st.set_page_config(
116
 
117
 
118
 
119
- @st.cache_data
 
 
120
  def load_scraped_web_info():
121
- with open("Banksandbanking.htm", "rb") as fp:
122
- banksandbanking_web_documents = pickle.load(fp)
123
-
124
-
125
- text_splitter = RecursiveCharacterTextSplitter(
126
- # Set a really small chunk size, just to show.
127
- chunk_size = 500,
128
- chunk_overlap = 100,
129
- length_function = len,
130
- )
131
-
132
- chunked_text = text_splitter.create_documents([doc for doc in tqdm(banksandbanking_web_documents)])
133
 
134
 
135
  @st.cache_resource
 
116
 
117
 
118
 
119
+ banksandbanking_web_documents = None
120
+
121
+ @st.cache
122
  def load_scraped_web_info():
123
+ global banksandbanking_web_documents
124
+ text_splitter = RecursiveCharacterTextSplitter(...)
125
+ chunked_text = text_splitter.create_documents(banksandbanking_web_documents)
126
+ return chunked_text
127
+
128
+ # Load pickle only once at startup
129
+ with open("Banksandbanking.htm", "rb") as fp:
130
+ banksandbanking_web_documents = pickle.load(fp)
 
 
 
 
131
 
132
 
133
  @st.cache_resource