Spaces:
Sleeping
Sleeping
KushwanthK
commited on
Upload 2 files
Browse files- app.py +11 -3
- requirements.txt +2 -1
app.py
CHANGED
@@ -9,7 +9,7 @@ import PyPDF2
|
|
9 |
import pymupdf
|
10 |
import tempfile
|
11 |
import base64
|
12 |
-
from tqdm.auto import tqdm
|
13 |
import math
|
14 |
# from transformers import pipeline
|
15 |
import nltk
|
@@ -26,6 +26,12 @@ from langchain_community.vectorstores import FAISS
|
|
26 |
from langchain.vectorstores import faiss
|
27 |
from langchain.vectorstores import FAISS
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
30 |
|
31 |
# if device != 'cuda':
|
@@ -195,8 +201,10 @@ def get_faiss_semantic_index():
|
|
195 |
index_path = "./HuggingFaceEmbeddings.pkl"
|
196 |
print(index_path)
|
197 |
# Load embeddings from the pickle file
|
198 |
-
with
|
199 |
-
|
|
|
|
|
200 |
st.write("Embeddings loaded successfully.")
|
201 |
return faiss_index
|
202 |
except Exception as e:
|
|
|
9 |
import pymupdf
|
10 |
import tempfile
|
11 |
import base64
|
12 |
+
# from tqdm.auto import tqdm
|
13 |
import math
|
14 |
# from transformers import pipeline
|
15 |
import nltk
|
|
|
26 |
from langchain.vectorstores import faiss
|
27 |
from langchain.vectorstores import FAISS
|
28 |
|
29 |
+
import time
|
30 |
+
from time import sleep
|
31 |
+
from stqdm import stqdm
|
32 |
+
|
33 |
+
|
34 |
+
|
35 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
36 |
|
37 |
# if device != 'cuda':
|
|
|
201 |
index_path = "./HuggingFaceEmbeddings.pkl"
|
202 |
print(index_path)
|
203 |
# Load embeddings from the pickle file
|
204 |
+
with stqdm(total=100, desc="Loading pickle file...") as progress_bar:
|
205 |
+
with open(index_path, "rb") as f:
|
206 |
+
faiss_index = pickle.load(f)
|
207 |
+
progress_bar.update(100)
|
208 |
st.write("Embeddings loaded successfully.")
|
209 |
return faiss_index
|
210 |
except Exception as e:
|
requirements.txt
CHANGED
@@ -15,4 +15,5 @@ nltk
|
|
15 |
langchain_community
|
16 |
langchain
|
17 |
faiss-gpu
|
18 |
-
faiss-cpu
|
|
|
|
15 |
langchain_community
|
16 |
langchain
|
17 |
faiss-gpu
|
18 |
+
faiss-cpu
|
19 |
+
stqdm
|