Jatila commited on
Commit
8dcb83f
Β·
verified Β·
1 Parent(s): 3d5a697

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -17,6 +17,7 @@ import torch
17
  import scipy.io.wavfile
18
  import tempfile
19
 
 
20
  from sentence_transformers import SentenceTransformer
21
  from huggingface_hub import InferenceClient
22
  from transformers import AutoTokenizer, pipeline
@@ -33,9 +34,15 @@ torch_dtype = torch.float16 if device == "cuda" else torch.float32
33
  print(f"Running on: {device}")
34
 
35
  # ── RAG: FAISS index ──────────────────────────────────────────
36
- print("Loading FAISS index...")
37
- index = faiss.read_index("alzheimers_index.faiss")
38
- with open("chunks.pkl", "rb") as f:
 
 
 
 
 
 
39
  chunks = pickle.load(f)
40
 
41
  embed_model = SentenceTransformer("all-MiniLM-L6-v2")
 
17
  import scipy.io.wavfile
18
  import tempfile
19
 
20
+ from huggingface_hub import hf_hub_download
21
  from sentence_transformers import SentenceTransformer
22
  from huggingface_hub import InferenceClient
23
  from transformers import AutoTokenizer, pipeline
 
34
  print(f"Running on: {device}")
35
 
36
  # ── RAG: FAISS index ──────────────────────────────────────────
37
+ print("Loading FAISS index and chunks from HF...")
38
+
39
+ HF_RAG_REPO = "AgentsWithoutBorders/alzheimers-faiss"
40
+
41
+ faiss_file = hf_hub_download(HF_RAG_REPO, "alzheimers_index_233.faiss")
42
+ chunks_file = hf_hub_download(HF_RAG_REPO, "chunks_233.pkl")
43
+
44
+ index = faiss.read_index(faiss_file)
45
+ with open(chunks_file, "rb") as f:
46
  chunks = pickle.load(f)
47
 
48
  embed_model = SentenceTransformer("all-MiniLM-L6-v2")