Spaces:
Running
Running
Upload folder using huggingface_hub
Browse files- .gitignore +2 -1
- config.py +1 -1
- copy_chromadb.py +8 -3
.gitignore
CHANGED
|
@@ -9,4 +9,5 @@ wheels/
|
|
| 9 |
# Virtual environments
|
| 10 |
.venv
|
| 11 |
.env
|
| 12 |
-
chromadb-store/
|
|
|
|
|
|
| 9 |
# Virtual environments
|
| 10 |
.venv
|
| 11 |
.env
|
| 12 |
+
chromadb-store/
|
| 13 |
+
chromadb-store.zip
|
config.py
CHANGED
|
@@ -101,7 +101,7 @@ class SanatanConfig:
|
|
| 101 |
"output_dir": "./output/vishnu_sahasranamam",
|
| 102 |
"collection_name": "vishnu_sahasranamam",
|
| 103 |
"pdf_path": "./data/vishnu_sahasranamam.pdf",
|
| 104 |
-
"source": "https://www.swami-krishnananda.org/vishnu/
|
| 105 |
"language": "san+eng",
|
| 106 |
"example_labels": ["Vanamali", "1000 names", "Sanskrit text search"],
|
| 107 |
"examples": [
|
|
|
|
| 101 |
"output_dir": "./output/vishnu_sahasranamam",
|
| 102 |
"collection_name": "vishnu_sahasranamam",
|
| 103 |
"pdf_path": "./data/vishnu_sahasranamam.pdf",
|
| 104 |
+
"source": "https://www.swami-krishnananda.org/vishnu/Sri_Vishnu_Sahasranama_Stotram.pdf",
|
| 105 |
"language": "san+eng",
|
| 106 |
"example_labels": ["Vanamali", "1000 names", "Sanskrit text search"],
|
| 107 |
"examples": [
|
copy_chromadb.py
CHANGED
|
@@ -1,18 +1,23 @@
|
|
| 1 |
import chromadb
|
| 2 |
|
| 3 |
# Connect to source and destination local persistent clients
|
| 4 |
-
source_client = chromadb.PersistentClient(path="../
|
| 5 |
destination_client = chromadb.PersistentClient(path="./chromadb-store")
|
|
|
|
|
|
|
| 6 |
|
| 7 |
# Get the source collection
|
| 8 |
-
source_collection = source_client.get_collection(
|
| 9 |
|
| 10 |
# Retrieve all data from the source collection
|
| 11 |
source_data = source_collection.get(ids=source_collection.peek()["ids"]) # Efficiently get all IDs
|
| 12 |
|
| 13 |
# Create or get the destination collection
|
|
|
|
|
|
|
|
|
|
| 14 |
destination_collection = destination_client.get_or_create_collection(
|
| 15 |
-
|
| 16 |
metadata=source_collection.metadata # Copy metadata if needed
|
| 17 |
)
|
| 18 |
|
|
|
|
| 1 |
import chromadb
|
| 2 |
|
| 3 |
# Connect to source and destination local persistent clients
|
| 4 |
+
source_client = chromadb.PersistentClient(path="../vishnu_sahasranamam_ai/output/chroma_store")
|
| 5 |
destination_client = chromadb.PersistentClient(path="./chromadb-store")
|
| 6 |
+
source_collection_name = "vishnu_sahasranamam"
|
| 7 |
+
destination_collection_name = "vishnu_sahasranamam"
|
| 8 |
|
| 9 |
# Get the source collection
|
| 10 |
+
source_collection = source_client.get_collection(source_collection_name)
|
| 11 |
|
| 12 |
# Retrieve all data from the source collection
|
| 13 |
source_data = source_collection.get(ids=source_collection.peek()["ids"]) # Efficiently get all IDs
|
| 14 |
|
| 15 |
# Create or get the destination collection
|
| 16 |
+
if destination_client.get_or_create_collection(destination_collection_name):
|
| 17 |
+
destination_client.delete_collection(destination_collection_name)
|
| 18 |
+
|
| 19 |
destination_collection = destination_client.get_or_create_collection(
|
| 20 |
+
destination_collection_name,
|
| 21 |
metadata=source_collection.metadata # Copy metadata if needed
|
| 22 |
)
|
| 23 |
|