ShrirajSK commited on
Commit
3da1749
·
1 Parent(s): 4a69037

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +6 -18
main.py CHANGED
@@ -8,27 +8,15 @@ class Airflow(BaseModel):
8
 
9
  app = FastAPI()
10
 
11
-
12
- origins = [ "https://huggingface.co", "https://*.huggingface.co",]
13
-
14
- app.add_middleware(
15
- CORSMiddleware,
16
- allow_origins=origins,
17
- allow_credentials=True,
18
- allow_methods=["*"],
19
- allow_headers=["*"],
20
- )
21
-
22
  model = joblib.load("gradient_boosting.joblib")
23
 
24
-
25
- @app.post("/")
26
  def read_root():
27
  return {"Hello": "World!"}
28
 
29
 
30
- @app.post("/api/volume_prediction")
31
- async def predict_volume(vol_moving_avg: float = Form(...), adj_close_rolling_med: float = Form(...)):
32
- features = [vol_moving_avg, adj_close_rolling_med]
33
- predicted_volume = model.predict([features])[0]
34
- return {"predicted_volume": predicted_volume}
 
8
 
9
  app = FastAPI()
10
 
 
 
 
 
 
 
 
 
 
 
 
11
  model = joblib.load("gradient_boosting.joblib")
12
 
13
+ @app.get("/")
 
14
  def read_root():
15
  return {"Hello": "World!"}
16
 
17
 
18
+ # @app.post("/api/volume_prediction")
19
+ # async def predict_volume(vol_moving_avg: float = Form(...), adj_close_rolling_med: float = Form(...)):
20
+ # features = [vol_moving_avg, adj_close_rolling_med]
21
+ # predicted_volume = model.predict([features])[0]
22
+ # return {"predicted_volume": predicted_volume}