Commit 55a6e272 by BoxuanXu

mv file

1 parent 47c87ba8
自动打包程序
<html>
<head>
<title>Build SDK Pkg Page</title>
</head>
<body>
{% if message %}
<p style="color:red">{{ message }}</p>
{% endif %}
<form>
<legend>Schedule</legend>
<table border="1">
<thead>
<tr>
<th>ModelID</th>
<th>Layer_Name</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{modelid}}</td>
<td>{{output_layer}}</td>
<td>{{progress}}</td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
<html>
<head>
<title>Please Input Modelid and layer_name</title>
</head>
<body>
{% if message %}
<p >{{ message }}</p>
{% endif %}
<form action="/test" method="post">
<p>MODELID: <input name="modelid"></p>
<p>OUTPUT_LAYER:<input name="output_layer"></p>
<p><button type="submit">Build SDK</button></p></form>
</body>
</html>
<html>
<head>
<title>Please Input Modelid and layer_name</title>
</head>
<body>
{% if message %}
<p style="color:red">{{ message }}</p>
{% endif %}
<form action="/test" method="post">
<p><input name="modelid"></p>
<p><input name="output_layer"></p>
<p><button type="submit">Build SDK</button></p></form>
</body>
</html>
from flask import Flask, url_for,request,render_template
import requests
app = Flask(__name__)
@app.route('/',methods=['GET','POST'])
def home():
return '<h1>Home</h1>'
modelid = "unknown"
progress = "unknown"
output_layer = "unknow"
@app.route('/test',methods=['GET'])
def test_form():
return render_template('edit.html',message='Edit Task')
#return '''<form action="/test" method="post">
# <p><input name="modelid"></p>
# <p><input name="output_layer"></p>
# <p><button type="submit">Build SDK</button></p></form>'''
@app.route('/result',methods=['GET'])
def get_test_result():
global modelid
global output_layer
global progress
return render_template('build_sdk.html',message='',modelid=modelid,output_layer=output_layer,progress=progress)
@app.route('/test',methods=['POST'])
def test_post():
global modelid
global output_layer
global progress
modelid=request.form['modelid']
output_layer=request.form['output_layer']
if request.form['modelid']!=None or request.form['output_layer']!=None:
post_return = { "modelid": modelid, "output_layer" : output_layer, "post_url" : "http://192.168.1.244:5000/result"}
result = requests.post("http://192.168.1.247:5000/convert", data=post_return)
if result.text == "Packing...":
progress = "Packing..."
else:
progress = "Failed"
return render_template('build_sdk.html',message='',modelid=modelid,output_layer=output_layer,progress=progress)
return render_template('wrong.html',message='Bad modelid or output_layer')
@app.route('/result',methods=['POST'])
def test_result():
global modelid
global return_flag
global progress
modelid=request.form['modelid']
return_flag=request.form['return_flag']
if request.form['modelid']!=None or request.form['return_flag']!=None:
if return_flag == "SUCCESS":
progress = "SUCCESS"
return "false"
else:
progress = "Failed"
return "false"
progress = "Failed"
return "false"
if __name__ == '__main__':
app.run('0.0.0.0')
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!