diff --git a/mnist-client/main.py b/mnist-client/main.py index 88f162dd82e69deda56d0aec5e71aa8a7deb328c..fc31e3977eba4246fc757a41e6fbf67eaee27f36 100644 --- a/mnist-client/main.py +++ b/mnist-client/main.py @@ -1,4 +1,5 @@ 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__': diff --git a/mnist-client/src/js/main.js b/mnist-client/src/js/main.js index 53ac0f7bcbf4e8c0758fd795dc137bdfb9172162..9f556b215ca14c18cf76c668f748941862fe525f 100644 --- a/mnist-client/src/js/main.js +++ b/mnist-client/src/js/main.js @@ -90,7 +90,7 @@ class Main { } } $.ajax({ - url: 'http://localhost:8000/', + url: BACKEND_URL, method: 'POST', contentType: 'application/json', data: JSON.stringify({"img":inputs}), diff --git a/mnist-client/templates/index.html b/mnist-client/templates/index.html index 115fc86b82d16e8cc00aa5e2f42d9c6222217b42..06240bfa95fad434f8c415d42c8ba5a5e04c790a 100644 --- a/mnist-client/templates/index.html +++ b/mnist-client/templates/index.html @@ -4,6 +4,9 @@