I have done preprocessing of a dataset and now I need to deploy it using Flask. I am getting this error.
ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=5000): Max retries exceeded with url: /preprocessing (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000002D405DBC0D0>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))
How can I fix it? Below I provide the code that generates the error
import os import requests import pandas as pd from pathlib import Path base_dir = Path(__file__).resolve().parent.parent data_dir = os.path.join(base_dir, 'dataset', 'diabetes_dataset.csv') output_dir = os.path.join(base_dir, 'output') datafile = pd.read_csv(data_dir) column_label = 'Outcome' cols = list(datafile.columns[:-1]) variable_name = 'Outcome' response = requests.post( url= 'http://127.0.0.1:5000/preprocessing', json= { "data_dir": os.path.join(base_dir, 'dataset', 'diabetes_dataset.csv'), "label": column_label, "cols": cols, "variable_name": variable_name, "output_dir": output_dir } ) print(response.text)