Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
| 24 |
-
months_since_start = (date -
|
| 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]
|