LazyBoss commited on
Commit
ac9442e
·
verified ·
1 Parent(s): 8c8454a

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +7 -1
main.py CHANGED
@@ -3,11 +3,17 @@ from pydantic import BaseModel
3
  from fastapi import FastAPI
4
  import uvicorn
5
  import logging
 
 
 
 
 
6
 
7
  logging.basicConfig(level = logging.INFO)
8
  # 1. Load the trained model
9
  model = joblib.load('frauddetection.pkl')
10
-
 
11
  # 2. Define the input data schema using Pydantic BaseModel
12
  class InputData(BaseModel):
13
  Year:int
 
3
  from fastapi import FastAPI
4
  import uvicorn
5
  import logging
6
+ import pickle
7
+
8
+
9
+
10
+ # Save using pickle
11
 
12
  logging.basicConfig(level = logging.INFO)
13
  # 1. Load the trained model
14
  model = joblib.load('frauddetection.pkl')
15
+ with open('frauddetection.pkl', 'wb') as f:
16
+ pickle.dump(model, f, protocol=pickle.HIGHEST_PROTOCOL)
17
  # 2. Define the input data schema using Pydantic BaseModel
18
  class InputData(BaseModel):
19
  Year:int