Skip to content

Commit

Permalink
Deployment Config
Browse files Browse the repository at this point in the history
  • Loading branch information
harinkris11 committed Aug 3, 2023
1 parent 7ea2e6c commit 6fa60d6
Show file tree
Hide file tree
Showing 6 changed files with 241 additions and 212 deletions.
Empty file added .ebextensions/python.config
Empty file.
41 changes: 41 additions & 0 deletions application.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
from flask import Flask, request, render_template
import numpy as np
import pandas as pd

from sklearn.preprocessing import StandardScaler
from src.pipeline.predict_pipeline import CustomData, predictpipeline

application = Flask(__name__)

app = application

@app.route('/')
def index():
return render_template('index.html')

@app.route('/predictdata', methods = ['GET','POST'])
def predict_datapoint():
if request.method == 'GET':
return render_template('home.html')
else:
data = CustomData(
gender=request.form.get('gender'),
race_ethnicity=request.form.get('ethnicity'),
parental_level_of_education=request.form.get('parental_level_of_education'),
lunch=request.form.get('lunch'),
test_preparation_course=request.form.get('test_preparation_course'),
reading_score=float(request.form.get('writing_score')),
writing_score=float(request.form.get('reading_score'))
)

pred_df = data.get_data_as_data_frame()
print(pred_df)
print("Before prediction")

predict_pipeline = predictpipeline()
results = predict_pipeline.predict(pred_df)
print("after prediction")
return render_template('home.html', results = results[0])

if __name__ == "__main__":
app.run(host="0.0.0.0", debug = True)
12 changes: 0 additions & 12 deletions apptry.py

This file was deleted.

Loading

0 comments on commit 6fa60d6

Please sign in to comment.