From bd306bb5282c05e9862c8b4d534ddbf7d7385584 Mon Sep 17 00:00:00 2001 From: Eduardo Blancas Date: Wed, 18 Sep 2024 11:57:20 -0600 Subject: [PATCH] fix --- src/soopervisor/assets/aws-lambda/app.py | 40 ++++++++++++------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/soopervisor/assets/aws-lambda/app.py b/src/soopervisor/assets/aws-lambda/app.py index 67ab4b44..177151ad 100644 --- a/src/soopervisor/assets/aws-lambda/app.py +++ b/src/soopervisor/assets/aws-lambda/app.py @@ -1,28 +1,28 @@ -# import json +import json -# import pandas as pd -# from ploomber import OnlineModel +import pandas as pd +from ploomber import OnlineModel -# import {{package_name}} +import {{package_name}} -# model = OnlineModel({{package_name}}) +model = OnlineModel({{package_name}}) -# def handler(event, context): -# body = json.loads(event['body']) +def handler(event, context): + body = json.loads(event['body']) -# raise NotImplementedError('Missing implementation ' -# 'in {{package_name}}/app.py. ' -# 'Add input parsing logic.') + raise NotImplementedError('Missing implementation ' + 'in {{package_name}}/app.py. ' + 'Add input parsing logic.') -# # NOTE: example implementation for a pipeline that expects a data frame -# # in a "get" task input -# df = pd.DataFrame(body, index=[0]) -# prediction = int(model.predict(get=df)[0]) + # NOTE: example implementation for a pipeline that expects a data frame + # in a "get" task input + df = pd.DataFrame(body, index=[0]) + prediction = int(model.predict(get=df)[0]) -# return { -# "statusCode": 200, -# "body": json.dumps({ -# "prediction": prediction -# }), -# } + return { + "statusCode": 200, + "body": json.dumps({ + "prediction": prediction + }), + }