Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -24,9 +24,8 @@ app.add_middleware(
|
|
24 |
|
25 |
|
26 |
|
27 |
-
def train_the_model(data):
|
28 |
-
|
29 |
-
try:
|
30 |
new_data = data
|
31 |
encoders = load('encoders.joblib')
|
32 |
xgb_model = load('xgb_model.joblib')
|
@@ -50,7 +49,8 @@ def train_the_model(data):
|
|
50 |
print("Model updated with new data.")
|
51 |
updated_model_accuracy = evaluate_model(xgb_model, X_test, y_test)
|
52 |
print("Updated model accuracy:", updated_model_accuracy)
|
53 |
-
|
|
|
54 |
data = data
|
55 |
|
56 |
# Select columns
|
@@ -156,7 +156,7 @@ async def your_continuous_function(page: int,paginate: int,Tenant: str):
|
|
156 |
print("data collected from page : "+str(page))
|
157 |
#data.to_csv("new.csv")
|
158 |
|
159 |
-
train_the_model(data)
|
160 |
|
161 |
return "model trained with page number: "+str(page)+" data count :"+str(data_count)
|
162 |
|
|
|
24 |
|
25 |
|
26 |
|
27 |
+
def train_the_model(data,page):
|
28 |
+
if page==2:
|
|
|
29 |
new_data = data
|
30 |
encoders = load('encoders.joblib')
|
31 |
xgb_model = load('xgb_model.joblib')
|
|
|
49 |
print("Model updated with new data.")
|
50 |
updated_model_accuracy = evaluate_model(xgb_model, X_test, y_test)
|
51 |
print("Updated model accuracy:", updated_model_accuracy)
|
52 |
+
|
53 |
+
else:
|
54 |
data = data
|
55 |
|
56 |
# Select columns
|
|
|
156 |
print("data collected from page : "+str(page))
|
157 |
#data.to_csv("new.csv")
|
158 |
|
159 |
+
train_the_model(data,page)
|
160 |
|
161 |
return "model trained with page number: "+str(page)+" data count :"+str(data_count)
|
162 |
|