提交 1b4fd0cc 编写于 作者: Y Yu Yang

Make mnist-client can set BACKEND_URL

上级 0f7f0244
from flask import Flask, jsonify, render_template, request
import os
# webapp
app = Flask(__name__)
......@@ -6,7 +7,8 @@ app = Flask(__name__)
@app.route('/')
def main():
return render_template('index.html')
backend_url = os.getenv('BACKEND_URL', 'http://localhost:8000/')
return render_template('index.html', backend_url=backend_url)
if __name__ == '__main__':
......
......@@ -90,7 +90,7 @@ class Main {
}
}
$.ajax({
url: 'http://localhost:8000/',
url: BACKEND_URL,
method: 'POST',
contentType: 'application/json',
data: JSON.stringify({"img":inputs}),
......
......@@ -4,6 +4,9 @@
<title>MNIST</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap.min.css') }}">
<script type="text/javascript" src="{{ url_for('static', filename='js/jquery.min.js') }}"></script>
<script type="text/javascript">
var BACKEND_URL = "{{ backend_url }}"
</script>
<script type="text/javascript" src="{{ url_for('static', filename='js/main.js') }}"></script>
</head>
<body>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册