Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
edublancas committed Sep 18, 2024
1 parent 6c1f889 commit bd306bb
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions src/soopervisor/assets/aws-lambda/app.py
Original file line number Diff line number Diff line change
@@ -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
}),
}

0 comments on commit bd306bb

Please sign in to comment.