Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -10,6 +10,7 @@ from sklearn.model_selection import train_test_split, GridSearchCV
|
|
| 10 |
from sklearn.preprocessing import LabelEncoder
|
| 11 |
from xgboost import XGBClassifier
|
| 12 |
from sklearn.metrics import accuracy_score, classification_report
|
|
|
|
| 13 |
|
| 14 |
app = FastAPI()
|
| 15 |
|
|
@@ -21,18 +22,7 @@ app.add_middleware(
|
|
| 21 |
allow_headers=["*"],
|
| 22 |
)
|
| 23 |
|
| 24 |
-
# Declare the continuous function as an async function.
|
| 25 |
-
#async def your_continuous_function():
|
| 26 |
-
|
| 27 |
-
#await asyncio.sleep(60) # Adjust the sleep interval as needed
|
| 28 |
|
| 29 |
-
# Create a startup event.
|
| 30 |
-
#@app.on_event("startup")
|
| 31 |
-
#async def startup_event():
|
| 32 |
-
# Start the continuous function as a background task.
|
| 33 |
-
#asyncio.create_task(your_continuous_function())
|
| 34 |
-
|
| 35 |
-
from joblib import dump
|
| 36 |
|
| 37 |
def train_the_model(data):
|
| 38 |
|
|
|
|
| 10 |
from sklearn.preprocessing import LabelEncoder
|
| 11 |
from xgboost import XGBClassifier
|
| 12 |
from sklearn.metrics import accuracy_score, classification_report
|
| 13 |
+
from joblib import dump, load
|
| 14 |
|
| 15 |
app = FastAPI()
|
| 16 |
|
|
|
|
| 22 |
allow_headers=["*"],
|
| 23 |
)
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
def train_the_model(data):
|
| 28 |
|