Spaces:
Running
Running
File size: 1,238 Bytes
8a6df40 |
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
from flask import Flask, render_template, request, redirect, url_for
from flask_ngrok import run_with_ngrok
from werkzeug.utils import secure_filename
from PIL import Image
import os
app = Flask(__name__)
run_with_ngrok(app)
data_list = []
@app.route('/', methods=['GET', 'POST'])
def main():
return render_template('main.html')
@app.route('/fileUpload', methods = ['GET', 'POST'])
def file_upload():
if request.method == 'POST':
f = request.files['file']
f_src = 'static/origin_web.jpg'
f.save(f_src)
return render_template('fileUpload.html')
@app.route('/fileUpload_cloth', methods = ['GET', 'POST'])
def fileUpload_cloth():
if request.method == 'POST':
f = request.files['file']
f_src = 'static/cloth_web.jpg'
f.save(f_src)
return render_template('fileUpload_cloth.html')
@app.route('/view', methods = ['GET', 'POST'])
def view():
print("inference start")
terminnal_command ="python main.py"
os.system(terminnal_command)
print("inference end")
return render_template('view.html', data_list=data_list) # html์ ๋ ๋ํ๋ฉฐ DB์์ ๋ฐ์์จ ๊ฐ๋ค์ ๋๊น
if __name__ == '__main__':
app.run() |