nataliegref commited on
Commit
32e8d39
·
1 Parent(s): d284c14

Update model api

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -4,9 +4,8 @@ import numpy as np
4
  import pickle
5
  from huggingface_hub import hf_hub_download
6
 
7
- app = FastAPI()
8
  # Download your model pickle from the Hub on startup
9
- model_path = hf_hub_download(repo_id="nataliegref/test-model", filename="trained_causal_model_v2.pkl")
10
 
11
  with open(model_path, "rb") as f:
12
  model = pickle.load(f)
@@ -14,7 +13,7 @@ with open(model_path, "rb") as f:
14
  class InputData(BaseModel):
15
  X: list
16
 
17
- @app.post("/predict")
18
  def predict(data: InputData):
19
  X = np.array(data.X)
20
  effect = model.effect(X).tolist()
 
4
  import pickle
5
  from huggingface_hub import hf_hub_download
6
 
 
7
  # Download your model pickle from the Hub on startup
8
+ model_path = hf_hub_download(repo_id="Projects-by-IF/causal-model", filename="trained_causal_model_v2.pkl")
9
 
10
  with open(model_path, "rb") as f:
11
  model = pickle.load(f)
 
13
  class InputData(BaseModel):
14
  X: list
15
 
16
+ @app.post("/model-effect")
17
  def predict(data: InputData):
18
  X = np.array(data.X)
19
  effect = model.effect(X).tolist()