-
Notifications
You must be signed in to change notification settings - Fork 3
/
app.py
34 lines (23 loc) · 800 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from flask import Flask,render_template,request
import os
from utils import pipeline_model
app = Flask(__name__)
@app.route('/')
def main():
return render_template("main.html")
@app.route('/breed')
def breed():
return render_template("breed.html")
@app.route('/predict',methods=['GET','POST'])
def predict():
if request.method=='POST':
img = request.files['image']
filename = img.filename
path = os.path.join('static/uploads',filename)
img.save(path)
print(filename)
predictions = pipeline_model(path)
return render_template("predict.html",p="uploads/{}".format(filename),pred=predictions)
return render_template("predict.html",p="images/dog.jpg",pred="")
if __name__ == '__main__':
app.run(port=8000,debug=True)