sairamv1 commited on
Commit
d1b5e6a
Β·
verified Β·
1 Parent(s): 10bf503

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -6,6 +6,7 @@ import numpy as np
6
  import cv2
7
  import requests
8
  from fastapi import FastAPI, File, UploadFile, HTTPException
 
9
 
10
  os.environ["KERAS_BACKEND"] = "jax"
11
  import keras
@@ -17,7 +18,15 @@ IMG_SIZE = 256
17
  THRESHOLD = 0.05 # ideally derived from healthy images [file:1]
18
 
19
  # ─── Load model once at startup ───────────────────────────────────────────────
20
- MODEL = keras.saving.load_model("hf://sairamv1/TeethCariesDetection_CNNAutoencoder")
 
 
 
 
 
 
 
 
21
 
22
  app = FastAPI()
23
 
 
6
  import cv2
7
  import requests
8
  from fastapi import FastAPI, File, UploadFile, HTTPException
9
+ from huggingface_hub import hf_hub_download # NEW
10
 
11
  os.environ["KERAS_BACKEND"] = "jax"
12
  import keras
 
18
  THRESHOLD = 0.05 # ideally derived from healthy images [file:1]
19
 
20
  # ─── Load model once at startup ───────────────────────────────────────────────
21
+ MODEL_REPO = "sairamv1/TeethCariesDetection_CNNAutoencoder"
22
+ MODEL_FILENAME = "autoencoder.keras" # or whatever file you uploaded
23
+
24
+ local_model_path = hf_hub_download(
25
+ repo_id=MODEL_REPO,
26
+ filename=MODEL_FILENAME,
27
+ )
28
+
29
+ MODEL = keras.saving.load_model(local_model_path)
30
 
31
  app = FastAPI()
32