Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -29,9 +29,9 @@ async def predict(model: UploadFile = File(...), data: str = None):
|
|
| 29 |
print(data)
|
| 30 |
# Process the data
|
| 31 |
predictions = model.predict(ds_normalized.reshape(1, 12, 1)).tolist()
|
| 32 |
-
predictions_rescaled = scaler.inverse_transform(predictions.reshape(-1, 1)).flatten()
|
| 33 |
|
| 34 |
-
return {"predictions":
|
| 35 |
|
| 36 |
except Exception as e:
|
| 37 |
raise HTTPException(status_code=500, detail=str(e))
|
|
@@ -53,7 +53,7 @@ async def retrain(model: UploadFile = File(...), data: str = None):
|
|
| 53 |
ds = np.array(ds).reshape(-1, 1)
|
| 54 |
# Normalize the data
|
| 55 |
scaler = MinMaxScaler()
|
| 56 |
-
|
| 57 |
|
| 58 |
x_train = np.array([ds_normalized[i - 12:i] for i in range(12, len(ds_normalized))])
|
| 59 |
y_train = ds_normalized[12:]
|
|
|
|
| 29 |
print(data)
|
| 30 |
# Process the data
|
| 31 |
predictions = model.predict(ds_normalized.reshape(1, 12, 1)).tolist()
|
| 32 |
+
#predictions_rescaled = scaler.inverse_transform(predictions.reshape(-1, 1)).flatten()
|
| 33 |
|
| 34 |
+
return {"predictions": predictions}
|
| 35 |
|
| 36 |
except Exception as e:
|
| 37 |
raise HTTPException(status_code=500, detail=str(e))
|
|
|
|
| 53 |
ds = np.array(ds).reshape(-1, 1)
|
| 54 |
# Normalize the data
|
| 55 |
scaler = MinMaxScaler()
|
| 56 |
+
ds_normalized = scaler.fit_transform(ds)
|
| 57 |
|
| 58 |
x_train = np.array([ds_normalized[i - 12:i] for i in range(12, len(ds_normalized))])
|
| 59 |
y_train = ds_normalized[12:]
|