Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -63,7 +63,7 @@ def save_faiss_index_to_hub(vectorstore, repo_id="MohammedNasser/faiss-index"):
|
|
| 63 |
vectorstore.save_local(index_dir)
|
| 64 |
|
| 65 |
# Initialize Hugging Face repository
|
| 66 |
-
repo = Repository(local_dir=index_dir, clone_from=repo_id)
|
| 67 |
|
| 68 |
# Push the FAISS index files to the Hugging Face Hub
|
| 69 |
repo.push_to_hub(commit_message="Pushing FAISS index")
|
|
@@ -91,8 +91,8 @@ def load_vectorstore(repo_id="MohammedNasser/faiss-index"):
|
|
| 91 |
|
| 92 |
|
| 93 |
# Download the FAISS index files from Hugging Face Hub
|
| 94 |
-
hf_hub_download(repo_id=repo_id, filename="index.faiss", local_dir=index_dir)
|
| 95 |
-
hf_hub_download(repo_id=repo_id, filename="index.json", local_dir=index_dir)
|
| 96 |
vectorstore = FAISS.load_local(index_dir, embeddings, allow_dangerous_deserialization=True)
|
| 97 |
return vectorstore
|
| 98 |
|
|
|
|
| 63 |
vectorstore.save_local(index_dir)
|
| 64 |
|
| 65 |
# Initialize Hugging Face repository
|
| 66 |
+
repo = Repository(local_dir=index_dir, clone_from=repo_id, repo_type="dataset")
|
| 67 |
|
| 68 |
# Push the FAISS index files to the Hugging Face Hub
|
| 69 |
repo.push_to_hub(commit_message="Pushing FAISS index")
|
|
|
|
| 91 |
|
| 92 |
|
| 93 |
# Download the FAISS index files from Hugging Face Hub
|
| 94 |
+
hf_hub_download(repo_id=repo_id, filename="index.faiss", local_dir=index_dir, repo_type="dataset")
|
| 95 |
+
hf_hub_download(repo_id=repo_id, filename="index.json", local_dir=index_dir, repo_type="dataset")
|
| 96 |
vectorstore = FAISS.load_local(index_dir, embeddings, allow_dangerous_deserialization=True)
|
| 97 |
return vectorstore
|
| 98 |
|