Spaces:
Runtime error
Runtime error
MEOW commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -35,12 +35,16 @@ def initialize_settings():
|
|
| 35 |
Settings.text_splitter = SentenceSplitter(chunk_size=600)
|
| 36 |
|
| 37 |
# Create index from documents
|
|
|
|
| 38 |
def create_index(documents):
|
| 39 |
vector_store = MilvusVectorStore(
|
| 40 |
host = "127.0.0.1",
|
| 41 |
port = 19530,
|
| 42 |
dim = 1024
|
|
|
|
|
|
|
| 43 |
)
|
|
|
|
| 44 |
# vector_store = MilvusVectorStore(uri="./milvus_demo.db", dim=1024, overwrite=True) #For CPU only vector store
|
| 45 |
storage_context = StorageContext.from_defaults(vector_store=vector_store)
|
| 46 |
return VectorStoreIndex.from_documents(documents, storage_context=storage_context)
|
|
|
|
| 35 |
Settings.text_splitter = SentenceSplitter(chunk_size=600)
|
| 36 |
|
| 37 |
# Create index from documents
|
| 38 |
+
|
| 39 |
def create_index(documents):
|
| 40 |
vector_store = MilvusVectorStore(
|
| 41 |
host = "127.0.0.1",
|
| 42 |
port = 19530,
|
| 43 |
dim = 1024
|
| 44 |
+
collection_name="your_collection_name",
|
| 45 |
+
gpu_id=0 # Specify the GPU ID to use
|
| 46 |
)
|
| 47 |
+
|
| 48 |
# vector_store = MilvusVectorStore(uri="./milvus_demo.db", dim=1024, overwrite=True) #For CPU only vector store
|
| 49 |
storage_context = StorageContext.from_defaults(vector_store=vector_store)
|
| 50 |
return VectorStoreIndex.from_documents(documents, storage_context=storage_context)
|