Commit 08398a31 authored by Sandro Luis Silva's avatar Sandro Luis Silva
Browse files

initial commit

parents
import numpy as np
import pandas as pd
import json
import pickle
from flask import Flask, request, jsonify, send_from_directory, redirect
from werkzeug.utils import secure_filename
app = Flask(__name__)
knn = open("data/knn.sav",'rb')
knn_model = pickle.load(knn)
@app.route('/', methods=['GET','POST'])
def index():
return send_from_directory('static', 'index.html')
@app.route('/get', methods=['GET'])
def get():
a = request.args['alcohol']
b = request.args['malic_acid']
c = request.args['ash']
d = request.args['alcalinity_of_ash']
e = request.args['magnesium']
f = request.args['phenols']
g = request.args['flavanoids']
h = request.args['nonflavanoid_phenols']
i = request.args['proanthocyanins']
j = request.args['color_intensity']
k = request.args['hue']
l = request.args['diluted_wines']
m = request.args['proline']
array = np.array([a,b,c,d,e,f,g,h,i,j,k,l,m])
d = {}
knn_result = knn_model.predict_proba(array.reshape(1,-1))
d['knn_result'] = knn_result[0].tolist()
return jsonify(d)
if __name__ == "__main__":
app.run()
\ No newline at end of file
This diff is collapsed.
File added
This diff is collapsed.
server {
# root /home/ubuntu/daw_indiv;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name silvasandro.com; # managed by Certbot
location / {
proxy_pass http://127.0.0.1:5000;
}
location /static {
alias /home/ubuntu/daw_indiv/static;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/silvasandro.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/silvasandro.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = silvasandro.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80 ;
listen [::]:80 ;
server_name silvasandro.com;
return 404; # managed by Certbot
}
name: base
channels:
- conda-forge
- defaults
dependencies:
- _ipyw_jlab_nb_ext_conf=0.1.0=py37_0
- _libgcc_mutex=0.1=main
- anaconda-client=1.7.2=py37_0
- anaconda-navigator=1.9.7=py37_0
- asn1crypto=1.2.0=py37_0
- attrs=19.3.0=py_0
- backcall=0.1.0=py37_0
- beautifulsoup4=4.8.1=py37_0
- blas=1.0=mkl
- bleach=3.1.0=py37_0
- bzip2=1.0.8=h7b6447c_0
- ca-certificates=2019.11.27=0
- cairo=1.14.12=h8948797_3
- certifi=2019.11.28=py37_0
- cffi=1.13.2=py37h2e261b9_0
- chardet=3.0.4=py37_1003
- click=7.0=py37_0
- clyent=1.2.2=py37_1
- conda=4.8.0=py37_1
- conda-build=3.17.8=py37_0
- conda-env=2.6.0=1
- conda-package-handling=1.6.0=py37h7b6447c_0
- conda-verify=3.1.1=py37_0
- cryptography=2.8=py37h1ba5d50_0
- dbus=1.13.12=h746ee38_0
- decorator=4.4.1=py_0
- defusedxml=0.6.0=py_0
- entrypoints=0.3=py37_0
- expat=2.2.6=he6710b0_0
- filelock=3.0.12=py_0
- flask=1.0.2=py37_1
- flask-socketio=3.3.2=py_0
- fontconfig=2.13.0=h9420a91_0
- freetype=2.9.1=h8a8886c_1
- fribidi=1.0.5=h7b6447c_0
- future=0.18.2=py37_0
- glib=2.63.1=h5a9c865_0
- glob2=0.7=py_0
- gmp=6.1.2=h6c8ec71_1
- graphite2=1.3.13=h23475e2_0
- graphviz=2.40.1=h21bd128_2
- gst-plugins-base=1.14.0=hbbd80ab_1
- gstreamer=1.14.0=hb453b48_1
- harfbuzz=1.8.8=hffaf4a1_0
- icu=58.2=h9c2bf20_1
- idna=2.8=py37_0
- importlib_metadata=1.3.0=py37_0
- intel-openmp=2019.4=243
- ipykernel=5.1.3=py37h39e3cac_0
- ipython=7.10.2=py37h39e3cac_0
- ipython_genutils=0.2.0=py37_0
- ipywidgets=7.5.1=py_0
- itsdangerous=1.1.0=py37_0
- jedi=0.15.1=py37_0
- jinja2=2.10.3=py_0
- jpeg=9b=h024ee3a_2
- json5=0.8.5=py_0
- jsonschema=3.2.0=py37_0
- jupyter_client=5.3.4=py37_0
- jupyter_core=4.6.1=py37_0
- jupyterlab=1.2.4=pyhf63ae98_0
- jupyterlab_server=1.0.6=py_0
- libarchive=3.3.3=h5d8350f_5
- libedit=3.1.20181209=hc058e9b_0
- libffi=3.2.1=hd88cf55_4
- libgcc-ng=9.1.0=hdf63c60_0
- libgfortran-ng=7.3.0=hdf63c60_0
- liblief=0.9.0=h7725739_2
- libpng=1.6.37=hbc83047_0
- libsodium=1.0.16=h1bed415_0
- libstdcxx-ng=9.1.0=hdf63c60_0
- libtiff=4.1.0=h2733197_0
- libuuid=1.0.3=h1bed415_2
- libxcb=1.13=h1bed415_1
- libxml2=2.9.9=hea5a465_1
- lz4-c=1.8.1.2=h14c3975_0
- lzo=2.10=h49e0be7_2
- markupsafe=1.1.1=py37h7b6447c_0
- mistune=0.8.4=py37h7b6447c_0
- mkl=2019.4=243
- mkl-service=2.3.0=py37he904b0f_0
- mkl_fft=1.0.15=py37ha843d7b_0
- mkl_random=1.1.0=py37hd6b4f25_0
- more-itertools=8.0.2=py_0
- mpi=1.0=openmpi
- navigator-updater=0.2.1=py37_0
- nbconvert=5.6.1=py37_0
- nbformat=4.4.0=py37_0
- ncurses=6.1=he6710b0_1
- notebook=6.0.2=py37_0
- numpy=1.17.4=py37hc1035e2_0
- numpy-base=1.17.4=py37hde5b4d6_0
- olefile=0.46=py37_0
- openmpi=4.0.2=hd49bf07_1
- openssl=1.1.1d=h7b6447c_3
- pandas=0.25.3=py37he6710b0_0
- pandoc=2.2.3.2=0
- pandocfilters=1.4.2=py37_1
- pango=1.42.4=h049681c_0
- parso=0.5.2=py_0
- patchelf=0.10=he6710b0_0
- pcre=8.43=he6710b0_0
- pexpect=4.7.0=py37_0
- pickleshare=0.7.5=py37_0
- pillow=6.2.1=py37h34e0f95_0
- pip=19.3.1=py37_0
- pixman=0.38.0=h7b6447c_0
- pkginfo=1.5.0.1=py37_0
- prometheus_client=0.7.1=py_0
- prompt_toolkit=3.0.2=py_0
- psutil=5.6.7=py37h7b6447c_0
- ptyprocess=0.6.0=py37_0
- py-lief=0.9.0=py37h7725739_2
- pycosat=0.6.3=py37h14c3975_0
- pycparser=2.19=py37_0
- pygments=2.5.2=py_0
- pyopenssl=19.1.0=py37_0
- pyqt=5.9.2=py37h05f1152_2
- pyrsistent=0.15.6=py37h7b6447c_0
- pysocks=1.7.1=py37_0
- python=3.7.3=h0371630_0
- python-dateutil=2.8.1=py_0
- python-engineio=3.9.3=py_0
- python-libarchive-c=2.8=py37_13
- python-socketio=3.1.2=py37_0
- pytz=2019.3=py_0
- pyyaml=5.2=py37h7b6447c_0
- pyzmq=18.1.0=py37he6710b0_0
- qt=5.9.7=h5867ecd_1
- qtpy=1.9.0=py_0
- readline=7.0=h7b6447c_5
- requests=2.22.0=py37_1
- retrying=1.3.3=py37_2
- ruamel_yaml=0.15.46=py37h14c3975_0
- scikit-learn=0.21.3=py37hd81dba3_0
- scipy=1.3.2=py37h7c811a0_0
- send2trash=1.5.0=py37_0
- setuptools=42.0.2=py37_0
- sip=4.19.8=py37hf484d3e_0
- six=1.13.0=py37_0
- soupsieve=1.9.5=py37_0
- sqlite=3.30.1=h7b6447c_0
- terminado=0.8.3=py37_0
- testpath=0.4.4=py_0
- tk=8.6.8=hbc83047_0
- tornado=6.0.3=py37h7b6447c_0
- tqdm=4.40.2=py_0
- traitlets=4.3.3=py37_0
- urllib3=1.25.7=py37_0
- wcwidth=0.1.7=py37_0
- webencodings=0.5.1=py37_1
- werkzeug=0.16.0=py_0
- wheel=0.33.6=py37_0
- widgetsnbextension=3.5.1=py37_0
- xz=5.2.4=h14c3975_4
- yaml=0.1.7=had09818_2
- zeromq=4.3.1=he6710b0_3
- zipp=0.6.0=py_0
- zlib=1.2.11=h7b6447c_3
- zstd=1.3.7=h0b5b093_0
- pip:
- absl-py==0.7.1
- arviz==0.4.1
- asteval==0.9.14
- astor==0.8.0
- atari-py==0.2.6
- autograd==1.3
- cached-property==1.5.1
- cachetools==3.1.1
- cftime==1.0.3.4
- colorlover==0.3.0
- cufflinks==0.15
- dash==1.6.0
- dash-core-components==1.5.0
- dash-html-components==1.0.1
- dash-renderer==1.2.0
- dash-table==4.5.0
- dill==0.3.0
- flask-compress==1.4.0
- gast==0.2.2
- google-auth==1.7.1
- google-auth-oauthlib==0.4.1
- google-cloud==0.34.0
- google-pasta==0.1.7
- grpcio==1.23.0
- gym==0.15.4
- imbalanced-learn==0.4.3
- joblib==0.13.2
- jupyter-contrib-core==0.3.3
- jupyter-contrib-nbextensions==0.5.1
- jupyter-highlight-selected-word==0.2.0
- jupyter-latex-envs==1.4.6
- jupyter-nbextensions-configurator==0.4.1
- kaggle==1.5.6
- keras==2.3.1
- keras-applications==1.0.8
- keras-preprocessing==1.1.0
- langdetect==1.0.7
- lifetimes==0.11.1
- linearmodels==4.12
- livereload==2.6.1
- lmfit==0.9.13
- markdown==3.1.1
- mglearn==0.1.7
- mkdocs==1.0.4
- nbopen==0.6
- netcdf4==1.5.1.2
- oauthlib==3.0.1
- opencv-python==4.1.2.30
- opt-einsum==3.1.0
- peakutils==1.3.2
- plotly==4.1.0
- pomegranate==0.11.0
- powerlaw==1.4.6
- protobuf==3.9.1
- psycopg2==2.8.3
- pyasn1==0.4.8
- pyasn1-modules==0.2.7
- pyclustering==0.9.0
- pydotplus==2.0.2
- pyfim==0.2
- pyglet==1.3.2
- pymc3==3.7
- python-graphviz==0.11.1
- python-slugify==4.0.0
- random-user-agent==1.0.1
- requests-oauthlib==1.2.0
- rsa==4.0
- selenium==3.141.0
- shap==0.29.3
- spotipy==2.4.4
- tensorboard==1.13.1
- tensorflow==1.13.1
- tensorflow-estimator==1.13.0
- termcolor==1.1.0
- text-unidecode==1.3
- theano==1.0.4
- thinkbayes2==2.0.0
- uncertainties==3.1.1
- unidecode==1.1.1
- watermark==1.8.1
- wordcloud==1.5.0
- xarray==0.12.1
- xgboost==0.90
prefix: /home/ssilva/anaconda3
html {
margin: 0;
padding: 0;
height: 100%;
min-width: 600px;
}
.title{
text-align:center;
font-size: 54px;
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
color: #434343;
padding: 0px 20%;
margin: 10px 0px;
}
.subtitle{
text-align:center;
font-size: 26px;
font-family: Arial, Helvetica, sans-serif;
color: #434343;
padding: 0px 20%;
margin: 10px 0px;
}
code {
font-weight: bold;
}
.subsection{
padding: 40px 20%;
margin: 10px 0px;
}
.subsection-title{
text-align:center;
font-size: 32px;
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
color: #434343;
padding: 10px 20%;
}
.subsection-prediction-results{
text-align:center;
font-size: 24px;
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
color: #434343;
padding: 10px 20%;
}
.subsection-prediction-subresults{
text-align:center;
font-size: 18px;
font-family: Arial, Helvetica, sans-serif;
color: #434343;
padding: 10px 20%;
}
.subsection-pred{
text-align:center;
font-size: 18px;
font-family: Arial, Helvetica, sans-serif;
color: #434343;
padding: 10px 20%;
}
.subsection-text{
text-align:justify;
font-size: 20px;
font-family: Arial, Helvetica, sans-serif;
color: #434343;
padding: 10px 15%;
}
.subsection-list{
text-align:left;
font-size: 15px;
margin-left: 150px;
font-weight: lighter;
font-family: Arial, Helvetica, sans-serif;
color: #434343;
padding: 0px 20%;
}
.subsection-prediction{
text-align:center;
font-size: 20px;
font-family: Arial, Helvetica, sans-serif;
color: #434343;
padding: 20px 15%;
}
.subsection-source{
text-align:center;
font-size: 20px;
font-family: Arial, Helvetica, sans-serif;
color: #434343;
padding: 20px 33%;
}
.subsection-result{
text-align:center;
font-size: 20px;
font-family: Arial, Helvetica, sans-serif;
color: #434343;
padding: 10px 20%;
}
/* CAROUSEL */
.carousel {
margin-left: 15%;
margin-right: 15%;
}
ul.slides {
display: block;
position: relative;
height: 800px;
margin: 0;
padding: 0;
overflow: hidden;
list-style: none;
}
.slides * {
user-select: none;
-ms-user-select: none;
-moz-user-select: none;
-khtml-user-select: none;
-webkit-user-select: none;
-webkit-touch-callout: none;
}
ul.slides input {
display: none;
}
.slide-container {
display: block;
}
.slide-image {
display: block;
position: absolute;
width: 100%;
height: 100%;
top: 0;
opacity: 0;
transition: all .7s ease-in-out;
}
.slide-image img {
width: auto;
min-width: 100%;
height: 100%;
}
.carousel-controls {
position: absolute;
top: 0;
left: 0;
right: 0;
z-index: 999;
font-size: 100px;
line-height: 600px;
color: #fff;
}
.carousel-controls label {
display: none;
position: absolute;
padding: 0 20px;
opacity: 0;
transition: opacity .2s;
cursor: pointer;
}
.slide-image:hover + .carousel-controls label{
opacity: 0.5;
}
.carousel-controls label:hover {
opacity: 1;
}
.carousel-controls .prev-slide {
width: 49%;
text-align: left;
left: 0;
}
.carousel-controls .next-slide {
width: 49%;
text-align: right;
right: 0;
}
.carousel-dots {
position: absolute;
left: 0;
right: 0;
bottom: 20px;
z-index: 999;
text-align: center;
}
.carousel-dots .carousel-dot {
display: inline-block;
width: 30px;
height: 30px;
border-radius: 50%;
background-color: #fff;
opacity: 0.5;
margin: 10px;
}
input:checked + .slide-container .slide-image {
opacity: 1;
transform: scale(1);
transition: opacity 1s ease-in-out;
}
input:checked + .slide-container .carousel-controls label {
display: block;
}
input#img-1:checked ~ .carousel-dots label#img-dot-1,
input#img-2:checked ~ .carousel-dots label#img-dot-2,
input#img-3:checked ~ .carousel-dots label#img-dot-3,
input#img-4:checked ~ .carousel-dots label#img-dot-4,
input#img-5:checked ~ .carousel-dots label#img-dot-5,
input#img-6:checked ~ .carousel-dots label#img-dot-6 {
opacity: 1;
}
input:checked + .slide-container .nav label {
display: block; }
/* HOW TO */
.how-to-header {
text-align:center;
font-size: 40px;
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
color: #434343;
padding: 20px 20%;
}
.how-to {
padding: 50px 20%;
font-size:x-large;
text-align: justify;
}
/* FORM */
/* #fields {
float:left;
} */
.form-portion {
float:left;
width: 350px;
/* margin: 20px; */
margin-right: 5%;
margin-left: 20%;
}
.form-style-7{
display:inline;
max-width:1200px;
margin:20px 30%;
background:#fff;
/* border-radius:5px; */
/* margin:50px; */
/* padding-left: 40vw; */
font-family: Georgia, "Times New Roman", Times, serif;
}
.form-style-7 h1{
display: block;
text-align: center;
padding: 0;
margin: 0px 0px 20px 0px;
color: #5C5C5C;