Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,14 @@ import pickle
|
|
5 |
from sentence_transformers import SentenceTransformer
|
6 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
# Load precomputed chunks and FAISS index
|
9 |
print("Loading precomputed data...")
|
10 |
with open("chunks.pkl", "rb") as f:
|
|
|
5 |
from sentence_transformers import SentenceTransformer
|
6 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
7 |
|
8 |
+
|
9 |
+
# Check if precomputed files exist and run preprocessing if needed
|
10 |
+
if not (os.path.exists("chunks.pkl") and os.path.exists("index.faiss")):
|
11 |
+
print("Precomputed files missing. Running preprocess.py...")
|
12 |
+
preprocess()
|
13 |
+
else:
|
14 |
+
print("Precomputed files found. Skipping preprocessing.")
|
15 |
+
|
16 |
# Load precomputed chunks and FAISS index
|
17 |
print("Loading precomputed data...")
|
18 |
with open("chunks.pkl", "rb") as f:
|