Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -30,7 +30,7 @@ async def predict(model: UploadFile = File(...), data: str = None):
|
|
30 |
raise HTTPException(status_code=500, detail=str(e))
|
31 |
|
32 |
@app.post("/retrain")
|
33 |
-
async def retrain(model: UploadFile = File(...), data:
|
34 |
try:
|
35 |
# Save the uploaded model and data to temporary files
|
36 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".h5") as temp_model_file:
|
@@ -43,7 +43,7 @@ async def retrain(model: UploadFile = File(...), data: UploadFile = File(...)):
|
|
43 |
|
44 |
# Load the model and data
|
45 |
model = load_model(temp_model_path, compile=False)
|
46 |
-
dataset = np.
|
47 |
|
48 |
# Normalize the data
|
49 |
scaler = MinMaxScaler()
|
|
|
30 |
raise HTTPException(status_code=500, detail=str(e))
|
31 |
|
32 |
@app.post("/retrain")
|
33 |
+
async def retrain(model: UploadFile = File(...), data: str = None):
|
34 |
try:
|
35 |
# Save the uploaded model and data to temporary files
|
36 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".h5") as temp_model_file:
|
|
|
43 |
|
44 |
# Load the model and data
|
45 |
model = load_model(temp_model_path, compile=False)
|
46 |
+
dataset = np.array(eval(data)).reshape(1, 12, 1)
|
47 |
|
48 |
# Normalize the data
|
49 |
scaler = MinMaxScaler()
|