Spaces:
Sleeping
Sleeping
test
Browse files
app.py
CHANGED
|
@@ -45,6 +45,7 @@ with open('embeddings.json', mode='r') as embedding_file:
|
|
| 45 |
|
| 46 |
for vhjx_index, vhjx_item in enumerate(raw_jsons):
|
| 47 |
chapter = vhjx_item[0]
|
|
|
|
| 48 |
docs = []
|
| 49 |
metas = []
|
| 50 |
for jvvi_item in vhjx_item[1:]:
|
|
@@ -62,7 +63,7 @@ for vhjx_index, vhjx_item in enumerate(raw_jsons):
|
|
| 62 |
# 批量生成 embeddings(每个为 list[float])
|
| 63 |
# emb_result = llm.create_embedding(docs)
|
| 64 |
embeddings = all_embs[vhjx_index] # List[List[float]]
|
| 65 |
-
|
| 66 |
# 准备数据
|
| 67 |
milvus_data = []
|
| 68 |
for i, emb in enumerate(embeddings):
|
|
@@ -76,6 +77,7 @@ for vhjx_index, vhjx_item in enumerate(raw_jsons):
|
|
| 76 |
"critique": item["critique"],
|
| 77 |
"chapter": item["chapter"]
|
| 78 |
})
|
|
|
|
| 79 |
|
| 80 |
# 插入数据
|
| 81 |
client.insert(collection_name="collection_1", data=milvus_data)
|
|
|
|
| 45 |
|
| 46 |
for vhjx_index, vhjx_item in enumerate(raw_jsons):
|
| 47 |
chapter = vhjx_item[0]
|
| 48 |
+
|
| 49 |
docs = []
|
| 50 |
metas = []
|
| 51 |
for jvvi_item in vhjx_item[1:]:
|
|
|
|
| 63 |
# 批量生成 embeddings(每个为 list[float])
|
| 64 |
# emb_result = llm.create_embedding(docs)
|
| 65 |
embeddings = all_embs[vhjx_index] # List[List[float]]
|
| 66 |
+
print(len(embeddings))
|
| 67 |
# 准备数据
|
| 68 |
milvus_data = []
|
| 69 |
for i, emb in enumerate(embeddings):
|
|
|
|
| 77 |
"critique": item["critique"],
|
| 78 |
"chapter": item["chapter"]
|
| 79 |
})
|
| 80 |
+
print(f"✅ 共 {len(milvus_data)} 条数据")
|
| 81 |
|
| 82 |
# 插入数据
|
| 83 |
client.insert(collection_name="collection_1", data=milvus_data)
|