Skip to content

Commit

Permalink
add flask files
Browse files Browse the repository at this point in the history
  • Loading branch information
leeyuntien committed Oct 5, 2019
1 parent f08fc38 commit 89fdb6e
Show file tree
Hide file tree
Showing 4 changed files with 162 additions and 0 deletions.
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: gunicorn app:app_t1
28 changes: 28 additions & 0 deletions app_t1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import pandas as pd
from flask import Flask, jsonify, request
import pickle

# load model
model = pickle.load(open('model_t1.pkl', 'rb'))

# app
app = Flask(__name__)

# routes
@app.route('/', methods=['POST'])

def predict():
# get data
data = request.get_json(force=True)
# convert data into dataframe
data.update((x, [y]) for x, y in data.items())
data_df = pd.DataFrame.from_dict(data)
# predictions
result = model.predict(data_df)
# send back to browser
output = {'results': int(result[0])}
# return data
return jsonify(results=output)

if __name__ == '__main__':
app.run(port=5000, debug=True)
Binary file added model_t1.pkl
Binary file not shown.
133 changes: 133 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
anaconda-client==1.7.2
anaconda-navigator==1.9.7
appdirs==1.4.3
appnope==0.1.0
asn1crypto==0.24.0
attrs==19.1.0
backcall==0.1.0
beautifulsoup4==4.8.0
bleach==3.1.0
bokeh==1.3.4
boto3==1.9.208
botocore==1.12.208
certifi==2019.9.11
cffi==1.12.3
chardet==3.0.4
Click==7.0
clyent==1.2.2
conda==4.7.12
conda-build==3.17.6
conda-package-handling==1.3.11
conda-verify==3.1.1
cryptography==2.7
cycler==0.10.0
decorator==4.4.0
defusedxml==0.6.0
Django==2.2.1
docx==0.2.4
entrypoints==0.3
facebook-sdk==3.1.0
feedparser==5.2.1
filelock==3.0.12
Flask==1.1.1
future==0.17.1
gensim==3.8.0
glob2==0.7
hickle==3.3.3
idna==2.8
ipykernel==5.1.2
ipython==7.8.0
ipython-genutils==0.2.0
ipywidgets==7.5.1
itsdangerous==1.1.0
jedi==0.15.1
Jinja2==2.10.1
jmespath==0.9.4
joblib==0.14.0
jsonschema==3.0.2
jupyter==1.0.0
jupyter-client==5.3.1
jupyter-console==6.0.0
jupyter-core==4.5.0
jupyterlab==0.35.6
jupyterlab-server==0.2.0
Keras==2.2.4
Keras-Applications==1.0.7
Keras-Preprocessing==1.0.8
kiwisolver==1.1.0
libarchive-c==2.8
lief==0.9.0
Mako==1.0.7
Markdown==3.1.1
MarkupSafe==1.1.1
matplotlib==3.1.1
mistune==0.8.4
mkl-fft==1.0.14
mkl-random==1.0.2
mkl-service==2.3.0
navigator-updater==0.2.1
nbconvert==5.5.0
nbformat==4.4.0
notebook==6.0.1
numpy==1.16.5
oauthlib==3.1.0
olefile==0.46
packaging==19.1
pandas==0.25.1
pandocfilters==1.4.2
panel==0.6.0
param==1.9.1
parso==0.5.1
pexpect==4.7.0
pickleshare==0.7.5
Pillow==6.1.0
pkginfo==1.5.0.1
prometheus-client==0.7.1
prompt-toolkit==2.0.9
psutil==5.6.3
ptyprocess==0.6.0
py4j==0.10.7
pycosat==0.6.3
pycparser==2.19
pyct==0.4.6
Pygments==2.4.2
pyOpenSSL==19.0.0
pyparsing==2.4.2
PyPDF2==1.26.0
pyrsistent==0.14.11
PySocks==1.7.0
pyspark==2.4.3
pytesseract==0.2.7
python-dateutil==2.8.0
pytools==2019.1
pytz==2019.2
pyviz-comms==0.7.2
PyYAML==5.1.2
pyzmq==18.1.0
qtconsole==4.5.5
QtPy==1.9.0
requests==2.22.0
requests-oauthlib==1.2.0
ruamel-yaml==0.15.46
s3transfer==0.2.1
scikit-learn==0.21.3
scipy==1.3.1
Send2Trash==1.5.0
six==1.12.0
smart-open==1.8.4
soupsieve==1.9.2
sqlparse==0.3.0
terminado==0.8.2
testpath==0.4.2
Theano==1.0.4
torch==1.2.0
tornado==6.0.3
tqdm==4.32.1
traitlets==4.3.2
tweepy==3.8.0
urllib3==1.24.2
utils==0.9.0
wcwidth==0.1.7
webencodings==0.5.1
Werkzeug==0.16.0
widgetsnbextension==3.5.1

0 comments on commit 89fdb6e

Please sign in to comment.