Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -33,16 +33,16 @@ def predict_rental_price():
|
|
| 33 |
|
| 34 |
# Extract relevant features from the JSON data
|
| 35 |
sample = {
|
| 36 |
-
'Product_Weight': property_data['
|
| 37 |
-
'Product_Sugar_Content': property_data['
|
| 38 |
-
'Product_Allocated_Area': property_data['
|
| 39 |
-
'Product_Type': property_data['
|
| 40 |
-
'Product_MRP': property_data['
|
| 41 |
-
'Store_Id': property_data['
|
| 42 |
-
'Store_Age': property_data['
|
| 43 |
-
'Store_Size': property_data['
|
| 44 |
-
'Store_Location_City_Type': property_data['
|
| 45 |
-
'Store_Type': property_data['
|
| 46 |
}
|
| 47 |
|
| 48 |
# Convert the extracted data into a Pandas DataFrame
|
|
@@ -55,7 +55,7 @@ def predict_rental_price():
|
|
| 55 |
predicted_price = round(float(predicted_price), 2)
|
| 56 |
return jsonify({'Predicted Revenue (in dollars)': predicted_price})
|
| 57 |
|
| 58 |
-
|
| 59 |
# Define an endpoint for batch prediction (POST request)
|
| 60 |
@rental_price_predictor_api.post('/v1/rentalbatch')
|
| 61 |
def predict_rental_price_batch():
|
|
@@ -88,7 +88,7 @@ def predict_rental_price_batch():
|
|
| 88 |
|
| 89 |
# Return the predictions dictionary as a JSON response
|
| 90 |
return jsonify(output_dict)
|
| 91 |
-
|
| 92 |
# Run the Flask application in debug mode if this script is executed directly
|
| 93 |
if __name__ == '__main__':
|
| 94 |
rental_price_predictor_api.run(debug=True)
|
|
|
|
| 33 |
|
| 34 |
# Extract relevant features from the JSON data
|
| 35 |
sample = {
|
| 36 |
+
'Product_Weight': property_data['product_weight'],
|
| 37 |
+
'Product_Sugar_Content': property_data['product_sugar_content'],
|
| 38 |
+
'Product_Allocated_Area': property_data['product_allocated_area'],
|
| 39 |
+
'Product_Type': property_data['product_type'],
|
| 40 |
+
'Product_MRP': property_data['product_mrp'],
|
| 41 |
+
'Store_Id': property_data['store_id'],
|
| 42 |
+
'Store_Age': property_data['store_age'],
|
| 43 |
+
'Store_Size': property_data['store_size'],
|
| 44 |
+
'Store_Location_City_Type': property_data['store_location_city_type'],
|
| 45 |
+
'Store_Type': property_data['store_type']
|
| 46 |
}
|
| 47 |
|
| 48 |
# Convert the extracted data into a Pandas DataFrame
|
|
|
|
| 55 |
predicted_price = round(float(predicted_price), 2)
|
| 56 |
return jsonify({'Predicted Revenue (in dollars)': predicted_price})
|
| 57 |
|
| 58 |
+
|
| 59 |
# Define an endpoint for batch prediction (POST request)
|
| 60 |
@rental_price_predictor_api.post('/v1/rentalbatch')
|
| 61 |
def predict_rental_price_batch():
|
|
|
|
| 88 |
|
| 89 |
# Return the predictions dictionary as a JSON response
|
| 90 |
return jsonify(output_dict)
|
| 91 |
+
|
| 92 |
# Run the Flask application in debug mode if this script is executed directly
|
| 93 |
if __name__ == '__main__':
|
| 94 |
rental_price_predictor_api.run(debug=True)
|