베이즈 몸무게 추론 모델을 Heroku에 배포하기 실습 준비 개발 환경 Windows 10 Anaconda 2019.03 Python 3.7 Flask 1.1.1 배포 환경 Heroku Python Flask Gunicorn 설치 프로그램 Git Heroku CLI Anaconda 프로젝트 폴더 프로젝트 소스는 아래 URL에서 다운로드할 수 있습니다. https://github.com/trvoid/bayesian-weight-inference 프로젝트 폴더 구조 bayesian-weight-inference\ templates\ index.html result.html .gitignore Procfile README.md requirements.txt script.py Heroku 계정 생성 Heroku 사이트에서 무료 계정을 생성합니다. 실습 진행 프로젝트 폴더 작업 script.py 파일 추가 bayesian-weight-inference 폴더 아래에 script.py 파일을 추가하고 텍스트 파일 편집기를 사용하여 아래 내용을 저장합니다. import numpy as np import scipy.stats as stats import flask app = flask.Flask(__name__) def get_posteriori(w_prior, s_prior, w_actual, s_actual, w_measured_arr): l_measured = stats.norm.pdf(w_measured_arr, w_actual, s_actual) weighting = stats.norm.pdf(w_actual, w_prior, s_prior) posteriori = np.prod(l_measured * weighting) retur...