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
table_node_mapping = SQLTableNodeMapping(sql_database) | |
table_schema_objs = [] | |
for table_name, table_description in all_tables: | |
table_schema_objs.append( | |
SQLTableSchema(table_name=table_name, context_str=table_description)) | |
print(table_node_mapping) | |
print(table_schema_objs) |
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
table_node_mapping = SQLTableNodeMapping(sql_database) | |
table_schema_objs = [] | |
for table_name, table_description in all_tables: | |
table_schema_objs.append( | |
SQLTableSchema(table_name=table_name, context_str=table_description)) | |
print(table_node_mapping) | |
print(table_schema_objs) |
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
@step | |
def deploy_best_model(self): | |
""" | |
Deploy the best model to AWS Lambda using SAM CLI | |
""" | |
try: | |
AWS_REGION = "ap-southeast-2" | |
BASE_PATH = "sam" | |
PROFILE_NAME = "Cevo-Dev.AWSFullAccountAdmin" | |
BEST_MODEL = self.MODEL_PKL_FILENAME |
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
[alias] | |
# one-line log | |
l = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short | |
a = add | |
ap = add -p | |
c = commit --verbose | |
ca = commit -a --verbose | |
cm = commit -m | |
cam = commit -a -m | |
m = commit --amend --verbose |
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, |
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_recommended_items(user_id): | |
ssm = boto3.client("ssm") | |
recommenderArn = ssm.get_parameter( | |
Name="/cevo-shopping-demo/recommender/arn-retaildemostore-recommended-for-you", | |
WithDecryption=False, | |
) | |
response = personalizeRuntime.get_recommendations( | |
recommenderArn=recommenderArn["Parameter"]["Value"], | |
userId=user_id, | |
numResults=30, |
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
import boto3 | |
from generators.generate_items_and_interactions_personalize import generate_user_items | |
bucket = "cevo-shopping-demo" | |
products_filename = "./generators/items.csv" | |
generate_user_items() | |
boto3.Session(profile_name=<aws-profile-replace-me>, region_name="ap-southeast-2").resource( | |
"s3" |
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
import boto3 | |
from generators.generate_items_and_interactions_personalize import generate_interactions | |
bucket = "cevo-shopping-demo" | |
interactions_filename = "./generators/interactions.csv" | |
generate_interactions() | |
boto3.Session(profile_name=<aws-profile-replace-me>, region_name="ap-southeast-2").resource( | |
"s3" |
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
import pandas as pd | |
import boto3 | |
from generators.generate_users_json import generate_users_json | |
bucket = "cevo-shopping-demo" | |
users_filename = "./generators/users.csv" | |
generate_users_json() | |
boto3.Session(profile_name=<aws-profile-replace-me>, region_name="ap-southeast-2").resource( |
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 getCustomLabelsOfImage(model_arn, bucket_name, image): | |
# Use boto3 call detect_custom_labels API call to get Rekognition Custom Labels | |
client = boto3.client("rekognition") | |
response = client.detect_custom_labels( | |
ProjectVersionArn=model_arn, | |
Image={"S3Object": {"Bucket": bucket_name, "Name": image}}, | |
MinConfidence=98, | |
) | |
return response["CustomLabels"] |
NewerOlder