Spaces:
Sleeping
Sleeping
import torch | |
from calculate_cosine_similarity import ( | |
find_most_similar_anchor, | |
find_most_similar_product, | |
recommend_shop_product, | |
) | |
def main(): | |
# 사용자 ID 입력 | |
user_id = "user_123" # 사용자 ID 예시 | |
# Step 1: 사용자와 가장 유사한 anchor 찾기 | |
print(f"Finding the most similar anchor for user {user_id}...") | |
most_similar_anchor, anchor_embedding = find_most_similar_anchor(user_id) | |
print(f"Most similar anchor: {most_similar_anchor}") | |
# Step 2: anchor와 가장 유사한 상품 찾기 | |
print("Finding the most similar product to the anchor...") | |
most_similar_product, similar_product_embedding = find_most_similar_product(anchor_embedding) | |
print(f"Most similar product to anchor: {most_similar_product}") | |
# Step 3: 쇼핑몰 상품 추천 | |
print("Recommending the best shop product...") | |
recommended_product_id = recommend_shop_product(similar_product_embedding) | |
print(f"Recommended shop product ID: {recommended_product_id}") | |
if __name__ == "__main__": | |
main() | |