Spaces:
Build error
Build error
Commit
·
1233a10
1
Parent(s):
cc87f36
Update weaviate_utils.py
Browse files- weaviate_utils.py +9 -1
weaviate_utils.py
CHANGED
@@ -85,8 +85,16 @@ def ingest_data_to_weaviate(client, csv_file, selected_class):
|
|
85 |
|
86 |
# After converting the CSV to a dataframe
|
87 |
embedded_table = tapas_utils.embed_table(dataframe)
|
|
|
|
|
|
|
|
|
88 |
# Store the embedded table in Weaviate
|
89 |
-
client.data_object.create({
|
|
|
|
|
|
|
|
|
90 |
|
91 |
# Fetch the schema for the selected class
|
92 |
class_schema = get_class_schema(client, selected_class)
|
|
|
85 |
|
86 |
# After converting the CSV to a dataframe
|
87 |
embedded_table = tapas_utils.embed_table(dataframe)
|
88 |
+
|
89 |
+
# Create a unique ID for the table (for example, based on its content)
|
90 |
+
table_id = hashlib.md5(dataframe.to_csv(index=False).encode()).hexdigest()
|
91 |
+
|
92 |
# Store the embedded table in Weaviate
|
93 |
+
client.data_object.create({
|
94 |
+
"id": table_id,
|
95 |
+
"embeddedTable": embedded_table.tolist(),
|
96 |
+
"content": dataframe.to_csv(index=False)
|
97 |
+
}, selected_class)
|
98 |
|
99 |
# Fetch the schema for the selected class
|
100 |
class_schema = get_class_schema(client, selected_class)
|