Spaces:
Running
on
Zero
Running
on
Zero
tet
Browse files- babyagi/classesa/diamond.py +10 -8
babyagi/classesa/diamond.py
CHANGED
@@ -51,9 +51,9 @@ class ProductDatabase:
|
|
51 |
query_vector = self.get_embedding(query_text).tolist() # ndarray をリストに変換
|
52 |
with self.conn.cursor() as cursor:
|
53 |
cursor.execute("""
|
54 |
-
SELECT id,
|
55 |
FROM diamondprice
|
56 |
-
|
57 |
""", (query_vector, top_k))
|
58 |
results = cursor.fetchall()
|
59 |
return results
|
@@ -75,11 +75,13 @@ def main():
|
|
75 |
query_text="1"
|
76 |
results = db.search_similar_all(query_text)
|
77 |
print("Search results:")
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
|
|
|
|
83 |
#return
|
84 |
# サンプルデータの挿入
|
85 |
#sample_text = """"""
|
@@ -92,7 +94,7 @@ def main():
|
|
92 |
|
93 |
# ベクトル検索
|
94 |
query_text = "12.03Very GoodJSI262.0587.27"
|
95 |
-
query_text = "
|
96 |
results = db.search_similar_vectors(query_text)
|
97 |
print("Search results:")
|
98 |
for result in results:
|
|
|
51 |
query_vector = self.get_embedding(query_text).tolist() # ndarray をリストに変換
|
52 |
with self.conn.cursor() as cursor:
|
53 |
cursor.execute("""
|
54 |
+
SELECT id,carat, cut, color, clarity, depth, diamondprice.table, x, y, z
|
55 |
FROM diamondprice
|
56 |
+
order by id asc
|
57 |
""", (query_vector, top_k))
|
58 |
results = cursor.fetchall()
|
59 |
return results
|
|
|
75 |
query_text="1"
|
76 |
results = db.search_similar_all(query_text)
|
77 |
print("Search results:")
|
78 |
+
DEBUG=0
|
79 |
+
if DEBUG==1:
|
80 |
+
for result in results:
|
81 |
+
print(result)
|
82 |
+
id = result[0]
|
83 |
+
sample_text = str(result[1])+"-"+str(result[2])+"-"+str(result[3])+"-"+str(result[4])+"-"+str(result[5])+"-"+str(result[6])+"-"+str(result[7])+"-"+str(result[8])+"-"+str(result[9])
|
84 |
+
db.insert_vector(id, sample_text)
|
85 |
#return
|
86 |
# サンプルデータの挿入
|
87 |
#sample_text = """"""
|
|
|
94 |
|
95 |
# ベクトル検索
|
96 |
query_text = "12.03Very GoodJSI262.0587.27"
|
97 |
+
query_text = "2.03-Very Good-J-SI2"
|
98 |
results = db.search_similar_vectors(query_text)
|
99 |
print("Search results:")
|
100 |
for result in results:
|