DevZoneX commited on
Commit
05a1079
·
1 Parent(s): f85bd6e

Upload linear regression model

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI
2
+ import joblib
3
+ import numpy as np
4
+
5
+ # Load your model
6
+ model = joblib.load("linear_regression_model.joblib")
7
+
8
+ app = FastAPI()
9
+
10
+ @app.post("/predict")
11
+ def predict(input_data: list):
12
+ # Convert input to numpy array and reshape if necessary
13
+ input_array = np.array(input_data).reshape(1, -1) # Adjust the shape based on your model's input
14
+ prediction = model.predict(input_array)
15
+ return {"prediction": prediction.tolist()}