From 75852f46efb401303b4c6c3689ba631ae18a5f4c Mon Sep 17 00:00:00 2001 From: mionaD-upc Date: Mon, 4 Dec 2023 22:38:15 +0100 Subject: [PATCH] modified curl call --- src/web/app.py | 4 +++- src/web/starter.py | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/web/app.py b/src/web/app.py index 831e6b5..6c4579c 100644 --- a/src/web/app.py +++ b/src/web/app.py @@ -54,7 +54,9 @@ def upload_file(): file.save(file_path) #print("The received argument variable is: ", adress) - command = f"curl -X POST -H 'Content-Type: multipart/form-data' -H 'Accept: application/json' -F 'beans_img=@{file_path}' http://{adress}:4000/make_prediction" + # MD change : (Pau instructions added) + command = 'curl -X POST -H "Content-Type: multipart/form-data" -H "Accept: application/json" -F "beans_img=@{}" http://{}:443/make_prediction'.format(file_path.replace("\\", "\\\\"), adress) + app.logger.info(command) # Get the classification result response = subprocess.getoutput(command) diff --git a/src/web/starter.py b/src/web/starter.py index e7d21a5..79a7d2e 100644 --- a/src/web/starter.py +++ b/src/web/starter.py @@ -17,7 +17,8 @@ def save_public_ip(public_ip): def run_app(public_ip): # Run app.py passing the public IP as an argument - subprocess.run(["python", "app.py", public_ip]) + # MD change: to python3 + subprocess.run(["python3", "app.py", public_ip]) def main(): docker_status = get_docker_status()