admattew commited on
Commit
4338e65
·
verified ·
1 Parent(s): e918821

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -6,7 +6,7 @@ import pandas as pd # For data manipulation
6
  from flask import Flask, request, jsonify # For creating the Flask API
7
 
8
  # Initialize Flask app with a name
9
- nozzleselect_api = Flask("ABM Nozzle Selection") #define the name of the app
10
 
11
  # Load the trained prediction model
12
  model = joblib.load("nozzle_selection_prediction_model.joblib") #define the location of the serialized model
@@ -21,7 +21,7 @@ def home():
21
  return "Welcome to ABM's Nozzle Select Predictor API!" #define a welcome message
22
 
23
  # Define an endpoint to predict churn for a single customer
24
- @nozzleselect_api_api.post('/v1/predict')
25
  def predict_nozzle():
26
  """
27
  This function handles POST requests to the '/v1/predict' endpoint.
@@ -54,11 +54,11 @@ def predict_nozzle():
54
  # Define an endpoint for batch prediction (POST request)
55
  @nozzleselect_api.post('/v1/predictbatch')
56
  def predict_nozzle_batch():
57
- """
58
  This function handles POST requests to the '/v1/predictbatch' endpoint.
59
  It expects a CSV file containing property details for multiple properties
60
  and returns the predicted rental prices as a dictionary in the JSON response.
61
- """
62
  # Get the uploaded CSV file from the request
63
  file = request.files['file']
64
 
@@ -70,7 +70,6 @@ def predict_nozzle_batch():
70
 
71
  # Return the prediction as a JSON response
72
  return jsonify({'nozzle': predicted_nozzle})
73
-
74
  """
75
 
76
  # Run the Flask app in debug mode
 
6
  from flask import Flask, request, jsonify # For creating the Flask API
7
 
8
  # Initialize Flask app with a name
9
+ nozzleselect_api = Flask("ABMs-Nozzle-Selection") #define the name of the app
10
 
11
  # Load the trained prediction model
12
  model = joblib.load("nozzle_selection_prediction_model.joblib") #define the location of the serialized model
 
21
  return "Welcome to ABM's Nozzle Select Predictor API!" #define a welcome message
22
 
23
  # Define an endpoint to predict churn for a single customer
24
+ @nozzleselect_api.post('/v1/predict')
25
  def predict_nozzle():
26
  """
27
  This function handles POST requests to the '/v1/predict' endpoint.
 
54
  # Define an endpoint for batch prediction (POST request)
55
  @nozzleselect_api.post('/v1/predictbatch')
56
  def predict_nozzle_batch():
57
+
58
  This function handles POST requests to the '/v1/predictbatch' endpoint.
59
  It expects a CSV file containing property details for multiple properties
60
  and returns the predicted rental prices as a dictionary in the JSON response.
61
+
62
  # Get the uploaded CSV file from the request
63
  file = request.files['file']
64
 
 
70
 
71
  # Return the prediction as a JSON response
72
  return jsonify({'nozzle': predicted_nozzle})
 
73
  """
74
 
75
  # Run the Flask app in debug mode