Created
April 22, 2023 08:18
-
-
Save jaeyow/35ddb6584eaf21be1160158dc7d04d29 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_popular_items(user_id="x"): | |
ssm = boto3.client("ssm") | |
recommenderArn = ssm.get_parameter( | |
Name="/cevo-shopping-demo/recommender/arn-retaildemostore-popular-items", | |
WithDecryption=False, | |
) | |
response = personalizeRuntime.get_recommendations( | |
recommenderArn=recommenderArn["Parameter"]["Value"], | |
userId=user_id, | |
numResults=100, | |
) | |
rec_items = [item["itemId"] for item in response["itemList"]] | |
print(f"Popular items: {rec_items}") | |
return rec_items |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment