Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -77,25 +77,9 @@ def embed_user_data(user_data):
|
|
| 77 |
return user_embedding.detach().numpy()
|
| 78 |
|
| 79 |
# MongoDB Atlas에서 데이터 가져오기
|
| 80 |
-
# product_data = product_collection.find_one({"product_id": 1}) # 특정 상품 ID
|
| 81 |
all_products = product_collection.find() # 모든 상품 데이터 가져오기
|
| 82 |
all_users = user_collection.find() # 모든 사용자 데이터 가져오기
|
| 83 |
|
| 84 |
-
# # 상품 임베딩 수행
|
| 85 |
-
# if product_data:
|
| 86 |
-
# product_embedding = embed_product_data(product_data)
|
| 87 |
-
# print("Product Embedding:", product_embedding)
|
| 88 |
-
|
| 89 |
-
# # MongoDB Atlas의 product_embeddings 컬렉션에 임베딩 저장
|
| 90 |
-
# product_embedding_collection.update_one(
|
| 91 |
-
# {"product_id": product_data["product_id"]}, # product_id 기준으로 찾기
|
| 92 |
-
# {"$set": {"embedding": product_embedding.tolist()}}, # 벡터를 리스트 형태로 저장
|
| 93 |
-
# upsert=True # 기존 항목이 없으면 새로 삽입
|
| 94 |
-
# )
|
| 95 |
-
# print("Embedding saved to MongoDB Atlas based on product_id.")
|
| 96 |
-
# else:
|
| 97 |
-
# print("Product not found.")
|
| 98 |
-
|
| 99 |
# 상품 임베딩 수행
|
| 100 |
for product_data in all_products:
|
| 101 |
product_embedding = embed_product_data(product_data)
|
|
|
|
| 77 |
return user_embedding.detach().numpy()
|
| 78 |
|
| 79 |
# MongoDB Atlas에서 데이터 가져오기
|
|
|
|
| 80 |
all_products = product_collection.find() # 모든 상품 데이터 가져오기
|
| 81 |
all_users = user_collection.find() # 모든 사용자 데이터 가져오기
|
| 82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
# 상품 임베딩 수행
|
| 84 |
for product_data in all_products:
|
| 85 |
product_embedding = embed_product_data(product_data)
|