File size: 1,057 Bytes
d917b06
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b4a0526
 
d917b06
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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()