Last active
April 3, 2019 04:30
-
-
Save jdunwoody/b970ca80d518b5b79ef2504460dc0d7a to your computer and use it in GitHub Desktop.
handler.py
This file contains hidden or 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
| # No imports before this unzip! | |
| try: | |
| import unzip_requirements | |
| except ImportError: | |
| pass | |
| from keras.models import load_model | |
| import pandas as pd | |
| def endpoint(event: dict, context): | |
| try: | |
| model = load_model("./data/model.h5") | |
| result_raw = model.predict(feature_values) | |
| result = pd.DataFrame(result_raw) | |
| # result.columns = ['home_team_score', 'away_team_score'] | |
| # scores_dictionary = result.iloc[0].round(0).astype('int').to_dict() | |
| body = { | |
| "message": result | |
| } | |
| response = { | |
| 'statusCode': 200, | |
| 'body': json.dumps(body) | |
| } | |
| except InputValidationError as e: | |
| response = { | |
| 'statusCode': 400, | |
| 'body': json.dumps(str(e)) | |
| } | |
| return response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment