sborhade commited on
Commit
1e68cdc
·
verified ·
1 Parent(s): f266853

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -20,8 +20,8 @@ class ForecastResponse(BaseModel):
20
  @app.post("/predict", response_model=ForecastResponse)
21
  async def predict_expense(request: ForecastRequest):
22
  # Convert input month to numerical format
23
- date = pd.to_datetime(request.month)
24
- months_since_start = (date - pd.to_datetime("2024-01-01")).days / 30
25
 
26
  # Predict using the model
27
  prediction = model.predict(np.array([[months_since_start]]))[0]
 
20
  @app.post("/predict", response_model=ForecastResponse)
21
  async def predict_expense(request: ForecastRequest):
22
  # Convert input month to numerical format
23
+ start_date = df["ds"].min() # Get the first date in dataset
24
+ months_since_start = (date - start_date).days / 30
25
 
26
  # Predict using the model
27
  prediction = model.predict(np.array([[months_since_start]]))[0]