Spaces:
Running
Running
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 = [] | |
def main(): | |
return render_template('main.html') | |
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') | |
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') | |
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() |